@radixdlt/atom
Version:
Container for CRUD instructions known as 'Particles' that are sent to the Radix decentralized ledger
79 lines • 4.35 kB
TypeScript
import { AnyDownParticle, AnySpunParticle, AnyUpParticle, DownParticle, ParticleBase, Spin, SpunParticleT, SpunParticleBase, UpParticle } from './_types';
import { Result } from 'neverthrow';
/**
* Creates an AnySpunParticle (type-erased SpunParticle) with a specified spin.
*
* @param spunParticleBase {SpunParticleBase} A particle of any type of to give a spin.
* @returns {AnySpunParticle} an AnySpunParticle (type-erased SpunParticle) with a specified spin.
*/
export declare const anySpunParticle: (spunParticleBase: SpunParticleBase) => AnySpunParticle;
/**
* Creates a typed SpunParticle with a specified spin.
*
* @param particle {P} A particle of typed type `P` to give a spin.
* @param spin {Spin} The spun of the particle
* @returns {SpunParticleT<P>} a typed SpunParticle with a specified spin.
* @template P a specific type of particle, that **is a** `ParticleBase`
*/
export declare const spunParticle: <P extends ParticleBase>(input: Readonly<{
spin: Spin;
particle: P;
}>) => SpunParticleT<P>;
/**
* Creates a typed UpParticle, a container for typed particle with the at compile time known Spin.UP.
*
* @param particle {P} A particle of typed type `P` to give the spin UP.
* @returns {UpParticle<P>} a typed UpParticle, a container for typed particle with the at compile time known Spin.UP.
* @template P a specific type of particle, that **is a** `ParticleBase`
*/
export declare const upParticle: <P extends ParticleBase>(particle: P) => UpParticle<P>;
/**
* Creates a typed DownParticle, a container for typed particle with the at compile time known Spin.Down.
*
* @param particle {P} A particle of typed type `P` to give the spin DOWN.
* @returns {DownParticle<P>} a typed DownParticle, a container for typed particle with the at compile time known Spin.Down.
* @template P a specific type of particle, that **is a** `ParticleBase`
*/
export declare const downParticle: <P extends ParticleBase>(particle: P) => DownParticle<P>;
/**
* Creates a typed SpunParticle with Spin.UP.
*
* @param particle {P} A particle of typed type `P` to give the spin UP.
* @returns {SpunParticleT<P>} a typed SpunParticle with a spin UP.
* @template P a specific type of particle, that **is a** `ParticleBase`
*/
export declare const spunUpParticle: <P extends ParticleBase>(particle: P) => SpunParticleT<P>;
/**
* Creates a typed SpunParticle with Spin.DOWN.
*
* @param particle {P} A particle of typed type `P` to give the spin DOWN.
* @returns {SpunParticleT<P>} a typed SpunParticle with a spin DOWN.
* @template P a specific type of particle, that **is a** `ParticleBase`
*/
export declare const spunDownParticle: <P extends ParticleBase>(particle: P) => SpunParticleT<P>;
/**
* Creates an AnyUpParticle (type-erased UpParticle) with the at compile time known spin UP.
*
* @param particle {ParticleBase} A particle of any type of to give the spin UP.
* @returns {AnyUpParticle} an AnyUpParticle (type-erased UpParticle) with the at compile time known spin UP.
*/
export declare const anyUpParticle: (particle: ParticleBase) => AnyUpParticle;
/**
* Creates an AnyDownParticle (type-erased DownParticle) with the at compile time known spin DOWN.
*
* @param particle {ParticleBase} A particle of any type of to give the spin DOWN.
* @returns {AnyDownParticle} an AnyDownParticle (type-erased DownParticle) with the at compile time known spin DOWN.
*/
export declare const anyDownParticle: (particle: ParticleBase) => AnyDownParticle;
export declare const asAnyUpParticle: (spunParticle: SpunParticleBase) => Result<AnyUpParticle, Error>;
export declare const asAnyDownParticle: (spunParticle: SpunParticleBase) => Result<AnyDownParticle, Error>;
export declare const asUpParticle: <P extends ParticleBase>(spunParticle: SpunParticleT<P>) => Result<UpParticle<P>, Error>;
export declare const asDownParticle: <P extends ParticleBase>(spunParticle: SpunParticleT<P>) => Result<DownParticle<P>, Error>;
export declare const isAnySpunParticle: (something: unknown) => something is AnySpunParticle;
export declare const SpunParticle: {
JSONDecoder: import("@radixdlt/data-formats").Decoder;
SERIALIZER: string;
fromJSON: (json: unknown) => Result<SpunParticleT<any>, Error[]>;
JSONDecoders: import("@radixdlt/data-formats").Decoder[];
};
//# sourceMappingURL=spunParticle.d.ts.map