@wormhole-foundation/sdk-definitions
Advanced tools
Comparing version 0.2.7-beta.0 to 0.3.0-beta.0
@@ -1,5 +0,6 @@ | ||
import { Chain } from "@wormhole-foundation/sdk-base"; | ||
import { Chain, ProtocolName } from "@wormhole-foundation/sdk-base"; | ||
import { SequenceId } from "./types"; | ||
import { UniversalAddress } from "./universalAddress"; | ||
import { VAA } from "./vaa"; | ||
export type AttestationId<PN extends ProtocolName = ProtocolName> = PN extends "TokenBridge" | "AutomaticTokenBridge" ? WormholeMessageId : PN extends "CircleBridge" | "AutomaticCircleBridge" ? CircleMessageId : PN extends "IbcBridge" ? IbcMessageId : never; | ||
export type WormholeMessageId = { | ||
@@ -9,3 +10,2 @@ chain: Chain; | ||
sequence: SequenceId; | ||
vaa?: VAA; | ||
}; | ||
@@ -15,3 +15,2 @@ export declare function isWormholeMessageId(thing: WormholeMessageId | any): thing is WormholeMessageId; | ||
export type CircleMessageId = { | ||
message: string; | ||
hash: string; | ||
@@ -18,0 +17,0 @@ }; |
@@ -11,3 +11,3 @@ "use strict"; | ||
function isCircleMessageId(thing) { | ||
return (thing.message !== undefined && thing.hash !== undefined); | ||
return thing.hash !== undefined; | ||
} | ||
@@ -14,0 +14,0 @@ exports.isCircleMessageId = isCircleMessageId; |
@@ -19,4 +19,4 @@ import { Chain, Network, Platform, ProtocolName } from "@wormhole-foundation/sdk-base"; | ||
export declare function getProtocolInitializer<P extends Platform, PN extends ProtocolName>(platform: P, protocol: PN): ProtocolInitializer<P, PN>; | ||
export declare const create: <N extends "Mainnet" | "Testnet" | "Devnet", P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm", PN extends "AutomaticCircleBridge" | "Relayer" | "WormholeCore" | "TokenBridge" | "AutomaticTokenBridge" | "CircleBridge" | "IbcBridge" | "NftBridge", T>(platform: P, protocol: PN, rpc: any, config: ChainsConfig<N, P>) => Promise<T>; | ||
export declare const create: <N extends "Mainnet" | "Testnet" | "Devnet", P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm", PN extends "WormholeCore" | "TokenBridge" | "AutomaticTokenBridge" | "CircleBridge" | "AutomaticCircleBridge" | "Relayer" | "IbcBridge" | "NftBridge", T>(platform: P, protocol: PN, rpc: any, config: ChainsConfig<N, P>) => Promise<T>; | ||
export {}; | ||
//# sourceMappingURL=protocol.d.ts.map |
@@ -98,2 +98,3 @@ import { Chain, LayoutToType, Network, Platform, PlatformToChains } from "@wormhole-foundation/sdk-base"; | ||
export declare const deserializeCircleMessage: (data: Uint8Array) => [CircleMessage, string]; | ||
export declare const serializeCircleMessage: (msg: CircleMessage) => Uint8Array; | ||
export type CircleTransferMessage = { | ||
@@ -104,4 +105,14 @@ from: ChainAddress; | ||
amount: bigint; | ||
messageId: CircleMessageId; | ||
message: CircleMessage; | ||
id: CircleMessageId; | ||
}; | ||
export type CircleTransferDetails = { | ||
amount: bigint; | ||
from: ChainAddress; | ||
to: ChainAddress; | ||
automatic?: boolean; | ||
payload?: Uint8Array; | ||
nativeGas?: bigint; | ||
}; | ||
export declare function isCircleTransferDetails(thing: any): thing is CircleTransferDetails; | ||
export interface AutomaticCircleBridge<N extends Network, P extends Platform, C extends Chain = PlatformToChains<P>> { | ||
@@ -112,3 +123,3 @@ getRelayerFee(destination: Chain): Promise<bigint>; | ||
export interface CircleBridge<N extends Network, P extends Platform, C extends PlatformToChains<P>> { | ||
redeem(sender: AccountAddress<C>, message: string, attestation: string): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
redeem(sender: AccountAddress<C>, message: CircleMessage, attestation: string): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
transfer(sender: AccountAddress<C>, recipient: ChainAddress, amount: bigint): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
@@ -115,0 +126,0 @@ parseTransactionDetails(txid: string): Promise<CircleTransferMessage>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deserializeCircleMessage = exports.circleMessageLayout = void 0; | ||
exports.isCircleTransferDetails = exports.serializeCircleMessage = exports.deserializeCircleMessage = exports.circleMessageLayout = void 0; | ||
const sdk_base_1 = require("@wormhole-foundation/sdk-base"); | ||
@@ -41,2 +41,12 @@ const layout_items_1 = require("../layout-items"); | ||
exports.deserializeCircleMessage = deserializeCircleMessage; | ||
const serializeCircleMessage = (msg) => { | ||
return (0, sdk_base_1.serializeLayout)(exports.circleMessageLayout, msg); | ||
}; | ||
exports.serializeCircleMessage = serializeCircleMessage; | ||
function isCircleTransferDetails(thing) { | ||
return (thing.amount !== undefined && | ||
thing.from !== undefined && | ||
thing.to !== undefined); | ||
} | ||
exports.isCircleTransferDetails = isCircleTransferDetails; | ||
//# sourceMappingURL=cctp.js.map |
@@ -13,2 +13,12 @@ import { Chain, Network, Platform, PlatformToChains } from "@wormhole-foundation/sdk-base"; | ||
} | ||
export type TokenTransferDetails = { | ||
token: TokenId | "native"; | ||
amount: bigint; | ||
from: ChainAddress; | ||
to: ChainAddress; | ||
automatic?: boolean; | ||
payload?: Uint8Array; | ||
nativeGas?: bigint; | ||
}; | ||
export declare function isTokenTransferDetails(thing: TokenTransferDetails | any): thing is TokenTransferDetails; | ||
export interface TokenBridge<N extends Network, P extends Platform, C extends PlatformToChains<P>> { | ||
@@ -15,0 +25,0 @@ isWrappedAsset(nativeAddress: TokenAddress<C>): Promise<boolean>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TokenBridge = exports.ErrNotWrapped = void 0; | ||
exports.isTokenTransferDetails = exports.TokenBridge = exports.ErrNotWrapped = void 0; | ||
const sdk_base_1 = require("@wormhole-foundation/sdk-base"); | ||
@@ -15,2 +15,9 @@ require("../payloads/tokenBridge"); | ||
})(TokenBridge || (exports.TokenBridge = TokenBridge = {})); | ||
function isTokenTransferDetails(thing) { | ||
return (thing.token !== undefined && | ||
thing.amount !== undefined && | ||
thing.from !== undefined && | ||
thing.to !== undefined); | ||
} | ||
exports.isTokenTransferDetails = isTokenTransferDetails; | ||
//# sourceMappingURL=tokenBridge.js.map |
@@ -14,4 +14,4 @@ import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer } from "@wormhole-foundation/sdk-base"; | ||
export declare function nativeChainAddress<C extends Chain>(chain: C, address: UniversalAddress | Uint8Array | string): ChainAddress<C>; | ||
export type TransactionId = { | ||
chain: Chain; | ||
export type TransactionId<C extends Chain = Chain> = { | ||
chain: C; | ||
txid: TxHash; | ||
@@ -18,0 +18,0 @@ }; |
@@ -1,5 +0,6 @@ | ||
import { Chain } from "@wormhole-foundation/sdk-base"; | ||
import { Chain, ProtocolName } from "@wormhole-foundation/sdk-base"; | ||
import { SequenceId } from "./types"; | ||
import { UniversalAddress } from "./universalAddress"; | ||
import { VAA } from "./vaa"; | ||
export type AttestationId<PN extends ProtocolName = ProtocolName> = PN extends "TokenBridge" | "AutomaticTokenBridge" ? WormholeMessageId : PN extends "CircleBridge" | "AutomaticCircleBridge" ? CircleMessageId : PN extends "IbcBridge" ? IbcMessageId : never; | ||
export type WormholeMessageId = { | ||
@@ -9,3 +10,2 @@ chain: Chain; | ||
sequence: SequenceId; | ||
vaa?: VAA; | ||
}; | ||
@@ -15,3 +15,2 @@ export declare function isWormholeMessageId(thing: WormholeMessageId | any): thing is WormholeMessageId; | ||
export type CircleMessageId = { | ||
message: string; | ||
hash: string; | ||
@@ -18,0 +17,0 @@ }; |
@@ -7,3 +7,3 @@ export function isWormholeMessageId(thing) { | ||
export function isCircleMessageId(thing) { | ||
return (thing.message !== undefined && thing.hash !== undefined); | ||
return thing.hash !== undefined; | ||
} | ||
@@ -10,0 +10,0 @@ export function isIbcMessageId(thing) { |
@@ -19,4 +19,4 @@ import { Chain, Network, Platform, ProtocolName } from "@wormhole-foundation/sdk-base"; | ||
export declare function getProtocolInitializer<P extends Platform, PN extends ProtocolName>(platform: P, protocol: PN): ProtocolInitializer<P, PN>; | ||
export declare const create: <N extends "Mainnet" | "Testnet" | "Devnet", P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm", PN extends "AutomaticCircleBridge" | "Relayer" | "WormholeCore" | "TokenBridge" | "AutomaticTokenBridge" | "CircleBridge" | "IbcBridge" | "NftBridge", T>(platform: P, protocol: PN, rpc: any, config: ChainsConfig<N, P>) => Promise<T>; | ||
export declare const create: <N extends "Mainnet" | "Testnet" | "Devnet", P extends "Solana" | "Algorand" | "Near" | "Sui" | "Aptos" | "Btc" | "Evm" | "Cosmwasm", PN extends "WormholeCore" | "TokenBridge" | "AutomaticTokenBridge" | "CircleBridge" | "AutomaticCircleBridge" | "Relayer" | "IbcBridge" | "NftBridge", T>(platform: P, protocol: PN, rpc: any, config: ChainsConfig<N, P>) => Promise<T>; | ||
export {}; | ||
//# sourceMappingURL=protocol.d.ts.map |
@@ -98,2 +98,3 @@ import { Chain, LayoutToType, Network, Platform, PlatformToChains } from "@wormhole-foundation/sdk-base"; | ||
export declare const deserializeCircleMessage: (data: Uint8Array) => [CircleMessage, string]; | ||
export declare const serializeCircleMessage: (msg: CircleMessage) => Uint8Array; | ||
export type CircleTransferMessage = { | ||
@@ -104,4 +105,14 @@ from: ChainAddress; | ||
amount: bigint; | ||
messageId: CircleMessageId; | ||
message: CircleMessage; | ||
id: CircleMessageId; | ||
}; | ||
export type CircleTransferDetails = { | ||
amount: bigint; | ||
from: ChainAddress; | ||
to: ChainAddress; | ||
automatic?: boolean; | ||
payload?: Uint8Array; | ||
nativeGas?: bigint; | ||
}; | ||
export declare function isCircleTransferDetails(thing: any): thing is CircleTransferDetails; | ||
export interface AutomaticCircleBridge<N extends Network, P extends Platform, C extends Chain = PlatformToChains<P>> { | ||
@@ -112,3 +123,3 @@ getRelayerFee(destination: Chain): Promise<bigint>; | ||
export interface CircleBridge<N extends Network, P extends Platform, C extends PlatformToChains<P>> { | ||
redeem(sender: AccountAddress<C>, message: string, attestation: string): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
redeem(sender: AccountAddress<C>, message: CircleMessage, attestation: string): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
transfer(sender: AccountAddress<C>, recipient: ChainAddress, amount: bigint): AsyncGenerator<UnsignedTransaction<N, C>>; | ||
@@ -115,0 +126,0 @@ parseTransactionDetails(txid: string): Promise<CircleTransferMessage>; |
@@ -1,2 +0,2 @@ | ||
import { deserializeLayout, encoding, } from "@wormhole-foundation/sdk-base"; | ||
import { deserializeLayout, encoding, serializeLayout, } from "@wormhole-foundation/sdk-base"; | ||
import { amountItem, circleDomainItem, circleNonceItem, universalAddressItem, } from "../layout-items"; | ||
@@ -37,2 +37,10 @@ import "../payloads/connect"; | ||
}; | ||
export const serializeCircleMessage = (msg) => { | ||
return serializeLayout(circleMessageLayout, msg); | ||
}; | ||
export function isCircleTransferDetails(thing) { | ||
return (thing.amount !== undefined && | ||
thing.from !== undefined && | ||
thing.to !== undefined); | ||
} | ||
//# sourceMappingURL=cctp.js.map |
@@ -13,2 +13,12 @@ import { Chain, Network, Platform, PlatformToChains } from "@wormhole-foundation/sdk-base"; | ||
} | ||
export type TokenTransferDetails = { | ||
token: TokenId | "native"; | ||
amount: bigint; | ||
from: ChainAddress; | ||
to: ChainAddress; | ||
automatic?: boolean; | ||
payload?: Uint8Array; | ||
nativeGas?: bigint; | ||
}; | ||
export declare function isTokenTransferDetails(thing: TokenTransferDetails | any): thing is TokenTransferDetails; | ||
export interface TokenBridge<N extends Network, P extends Platform, C extends PlatformToChains<P>> { | ||
@@ -15,0 +25,0 @@ isWrappedAsset(nativeAddress: TokenAddress<C>): Promise<boolean>; |
@@ -11,2 +11,8 @@ import { lazyInstantiate, } from "@wormhole-foundation/sdk-base"; | ||
})(TokenBridge || (TokenBridge = {})); | ||
export function isTokenTransferDetails(thing) { | ||
return (thing.token !== undefined && | ||
thing.amount !== undefined && | ||
thing.from !== undefined && | ||
thing.to !== undefined); | ||
} | ||
//# sourceMappingURL=tokenBridge.js.map |
@@ -14,4 +14,4 @@ import { Chain, ChainToPlatform, Network, Platform, PlatformToChains, explorer } from "@wormhole-foundation/sdk-base"; | ||
export declare function nativeChainAddress<C extends Chain>(chain: C, address: UniversalAddress | Uint8Array | string): ChainAddress<C>; | ||
export type TransactionId = { | ||
chain: Chain; | ||
export type TransactionId<C extends Chain = Chain> = { | ||
chain: C; | ||
txid: TxHash; | ||
@@ -18,0 +18,0 @@ }; |
{ | ||
"name": "@wormhole-foundation/sdk-definitions", | ||
"version": "0.2.7-beta.0", | ||
"version": "0.3.0-beta.0", | ||
"repository": { | ||
@@ -33,4 +33,4 @@ "type": "git", | ||
"@noble/hashes": "^1.3.1", | ||
"@wormhole-foundation/sdk-base": "^0.2.7-beta.0" | ||
"@wormhole-foundation/sdk-base": "^0.3.0-beta.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
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
699167
9004
+ Added@wormhole-foundation/sdk-base@0.3.3(transitive)
- Removed@wormhole-foundation/sdk-base@0.2.7-beta.0(transitive)