Skip to content

TokenOrder.ts

This module provides a high-level API for UCS03 TokenOrderV2 instruction construction.

Added in v2.0.0

Signature

export declare const setReceiver: {
(receiver: Ucs05.AnyDisplay | string): (self: TokenOrder) => Effect.Effect<TokenOrder, ParseError>
(self: TokenOrder, receiver: Ucs05.AnyDisplay | string): Effect.Effect<TokenOrder, ParseError>
}

Source: src/TokenOrder.ts:230

Added in v2.0.0

Signature

export declare const setSender: {
(sender: Ucs05.AnyDisplay | string): (self: TokenOrder) => Effect.Effect<TokenOrder, ParseError>
(self: TokenOrder, sender: Ucs05.AnyDisplay | string): Effect.Effect<TokenOrder, ParseError>
}

Source: src/TokenOrder.ts:221

Added in v2.0.0

Signature

export declare const make: <P extends Options.Required & Partial<Options.Optional>>(
value: P
) => Effect.Effect<
Exclude<keyof Options, keyof P> extends never ? TokenOrder : TokenOrder.Build<Exclude<keyof Options, keyof P>>,
ParseResult.ParseError,
never
>

Source: src/TokenOrder.ts:193

Added in v2.0.0

Signature

export type InputDecoded = typeof Input.Type

Source: src/TokenOrder.ts:79

Added in v2.0.0

Signature

export type InputEncoded = typeof Input.Encoded

Source: src/TokenOrder.ts:74

Added in v2.0.0

Signature

export declare const Kind: S.Union<
[S.Literal<["initialize"]>, S.Literal<["escrow"]>, S.Literal<["unescrow"]>, S.Literal<["solve"]>]
>

Source: src/TokenOrder.ts:40

Added in v2.0.0

Signature

export type Kind = typeof Kind.Type

Source: src/TokenOrder.ts:50

Added in v2.0.0

Signature

export interface TokenOrder
extends TokenOrder.Variance<never>,
Inspectable,
Pipeable,
InputDecoded,
Iterable<ZkgmInstruction.ZkgmInstruction> {
// ZkgmInstruction.Encodeable<ParseError, never>
readonly _tag: "TokenOrder"
readonly opcode: 3
readonly version: 1 | 2
}

Source: src/TokenOrder.ts:95

Added in v2.0.0

Signature

export declare const Input: S.Struct<{
source: S.SchemaClass<Chain, Chain, never>
destination: S.SchemaClass<Chain, Chain, never>
sender: S.Union<
[
S.Union<
[
S.Struct<{ _tag: S.tag<"CosmosDisplay">; address: S.filter<S.TemplateLiteral<`${string}1${string}`>> }>,
S.Struct<{ _tag: S.tag<"EvmDisplay">; address: S.refine<`0x${string}`, S.Schema<string, string, never>> }>
]
>,
S.transformOrFail<
typeof S.String,
S.Union<
[
S.Struct<{ _tag: S.tag<"CosmosDisplay">; address: S.filter<S.TemplateLiteral<`${string}1${string}`>> }>,
S.Struct<{ _tag: S.tag<"EvmDisplay">; address: S.refine<`0x${string}`, S.Schema<string, string, never>> }>
]
>,
never
>
]
>
receiver: S.Union<
[
S.Union<
[
S.Struct<{ _tag: S.tag<"CosmosDisplay">; address: S.filter<S.TemplateLiteral<`${string}1${string}`>> }>,
S.Struct<{ _tag: S.tag<"EvmDisplay">; address: S.refine<`0x${string}`, S.Schema<string, string, never>> }>
]
>,
S.transformOrFail<
typeof S.String,
S.Union<
[
S.Struct<{ _tag: S.tag<"CosmosDisplay">; address: S.filter<S.TemplateLiteral<`${string}1${string}`>> }>,
S.Struct<{ _tag: S.tag<"EvmDisplay">; address: S.refine<`0x${string}`, S.Schema<string, string, never>> }>
]
>,
never
>
]
>
baseToken: S.Union<
[
S.Union<
[
typeof Token.Erc20,
typeof Token.EvmGas,
typeof Token.Cw20,
typeof Token.CosmosTokenFactory,
typeof Token.CosmosBank,
typeof Token.CosmosIbcClassic
]
>,
S.transformOrFail<
typeof S.String,
S.Union<
[
typeof Token.Erc20,
typeof Token.EvmGas,
typeof Token.Cw20,
typeof Token.CosmosTokenFactory,
typeof Token.CosmosBank,
typeof Token.CosmosIbcClassic
]
>,
never
>
]
>
baseAmount: typeof S.BigIntFromSelf
quoteToken: S.Union<
[
S.Union<
[
typeof Token.Erc20,
typeof Token.EvmGas,
typeof Token.Cw20,
typeof Token.CosmosTokenFactory,
typeof Token.CosmosBank,
typeof Token.CosmosIbcClassic
]
>,
S.transformOrFail<
typeof S.String,
S.Union<
[
typeof Token.Erc20,
typeof Token.EvmGas,
typeof Token.Cw20,
typeof Token.CosmosTokenFactory,
typeof Token.CosmosBank,
typeof Token.CosmosIbcClassic
]
>,
never
>
]
>
quoteAmount: typeof S.BigIntFromSelf
kind: S.Union<[S.Literal<["initialize"]>, S.Literal<["escrow"]>, S.Literal<["unescrow"]>, S.Literal<["solve"]>]>
metadata: S.optional<S.TemplateLiteral<`0x${string}`>>
version: S.optional<S.Union<[S.Literal<[1]>, S.Literal<[2]>]>>
}>

Source: src/TokenOrder.ts:56

Added in v2.0.0

Signature

export declare const isTokenOrder: (u: unknown) => u is TokenOrder

Source: src/TokenOrder.ts:187

Added in v2.0.0

Signature

export declare const TypeId: typeof TypeId

Source: src/TokenOrder.ts:28

Added in v2.0.0

Signature

export type TypeId = typeof TypeId

Source: src/TokenOrder.ts:34

Added in v2.0.0

Added in v2.0.0

Signature

export type Complete = Required & Optional

Source: src/TokenOrder.ts:180

Added in v2.0.0

Signature

export type Optional = Omit<Options, RequiredKeys>

Source: src/TokenOrder.ts:175

Added in v2.0.0

Signature

export type Required = {
-readonly [K in RequiredKeys]-?: NonNullable<Options[K]>
}

Source: src/TokenOrder.ts:168

Added in v2.0.0

Signature

export type RequiredKeys = "source" | "destination" | "sender" | "receiver" | "baseToken" | "baseAmount"

Source: src/TokenOrder.ts:157

Added in v2.0.0

Added in v2.0.0

Collapses to TokeOnder when complete, otherwise tracks variance and partiality.

Signature

export interface Build<M extends keyof TokenOrder = never> extends Variance<M>, Pipeable {}

Source: src/TokenOrder.ts:131

Added in v2.0.0

Signature

export interface Variance<out M> {
readonly [TypeId]: VarianceStruct<M>
}

Source: src/TokenOrder.ts:115

Added in v2.0.0

Signature

export interface VarianceStruct<out M> {
readonly _M: Covariant<M>
}

Source: src/TokenOrder.ts:122

Added in v2.0.0

Alias for a completed TokenOrder

Signature

export type Complete = Build<never>

Source: src/TokenOrder.ts:147

Added in v2.0.0

Extracts missing keys from a partial TokenOrder

Signature

export type Missing<T extends Build<any>> = T extends Build<infer M> ? M : never

Source: src/TokenOrder.ts:140

Added in v2.0.0

Signature

export declare const encodeV1: (
self: TokenOrder
) => (meta: {
name: string
decimals: number
symbol: string
sourceChannelId: number
}) => Effect.Effect<Ucs03.TokenOrderV1, ParseError, never>

Source: src/TokenOrder.ts:253

Added in v2.0.0

Signature

export declare const encodeV2: (self: TokenOrder) => Effect.Effect<Ucs03.TokenOrderV2, ParseError, never>

Source: src/TokenOrder.ts:263

Added in v2.0.0