UNPKG

@radixdlt/atom

Version:

Container for CRUD instructions known as 'Particles' that are sent to the Radix decentralized ledger

94 lines 3.81 kB
import { AddressT } from '@radixdlt/account'; import { DSONCodable, JSONEncodable } from '@radixdlt/data-formats'; import { AmountT, Granularity, Nonce } from '@radixdlt/primitives'; import { Result } from 'neverthrow'; import { ResourceIdentifierT, TokenPermissions } from '../_types'; import { RadixParticleType } from './meta/radixParticleTypes'; export declare type ParticleBase = JSONEncodable & DSONCodable & Readonly<{ equals: (other: ParticleBase) => boolean; }>; export declare type RadixParticle = ParticleBase & Readonly<{ radixParticleType: RadixParticleType; }>; export declare type TokenBase = Readonly<{ granularity: Granularity; resourceIdentifier: ResourceIdentifierT; }>; export declare type TokenParticle = TokenBase & RadixParticle & Readonly<{ permissions: TokenPermissions; amount: AmountT; nonce: Nonce; }>; export declare type TransferrableTokensParticleT = RadixParticle & TokenParticle & TransferrableTokensParticleProps; export declare type TransferrableTokensParticleProps = Readonly<{ address: AddressT; }>; export declare type UnallocatedTokensParticleT = RadixParticle & TokenParticle; export declare type ResourceIdentifierParticleT = RadixParticle & Readonly<{ radixParticleType: RadixParticleType; alwaysZeroNonce: Nonce; resourceIdentifier: ResourceIdentifierT; }>; export declare type TokenDefinitionBase = TokenBase & Readonly<{ name: string; description?: string; url?: string; iconURL?: string; }>; export declare type TokenDefinitionParticleBase = TokenDefinitionBase & RadixParticle; export declare type FixedSupplyTokenDefinitionParticleT = TokenDefinitionParticleBase & Readonly<{ fixedTokenSupply: AmountT; }>; export declare type MutableSupplyTokenDefinitionParticleT = TokenDefinitionParticleBase & Readonly<{ permissions: TokenPermissions; }>; export declare enum Spin { UP = 1, DOWN = -1 } export declare type SpunParticleBase = Readonly<{ spin: Spin; particle: ParticleBase; }>; export declare type AnySpunParticle = JSONEncodable & DSONCodable & SpunParticleBase & Readonly<{ downedAsAny: () => Result<AnyDownParticle, Error>; equals: (other: SpunParticleBase) => boolean; }>; export declare type SpunParticleT<P extends ParticleBase> = AnySpunParticle & Readonly<{ particle: P; eraseToAny: () => AnySpunParticle; downed: () => Result<DownParticle<P>, Error>; }>; export declare type UpParticle<P extends ParticleBase> = SpunParticleT<P> & Readonly<{ spin: Spin.UP; toSpunParticle: () => SpunParticleT<P>; eraseToAnyUp: () => AnyUpParticle; }>; export declare type DownParticle<P extends ParticleBase> = SpunParticleT<P> & Readonly<{ spin: Spin.DOWN; particle: P; toSpunParticle: () => SpunParticleT<P>; eraseToAnyDown: () => AnyDownParticle; }>; export declare type AnyUpParticle = AnySpunParticle & Readonly<{ spin: Spin.UP; toAnySpunParticle: () => AnySpunParticle; }>; export declare type AnyDownParticle = AnySpunParticle & Readonly<{ spin: Spin.DOWN; toAnySpunParticle: () => AnySpunParticle; }>; export declare type SpunParticleQueryable = Readonly<{ anySpunParticlesOfTypeWithSpin: (query: { particleTypes?: RadixParticleType[]; spin?: Spin; }) => AnySpunParticle[]; upParticles: () => AnyUpParticle[]; transferrableTokensParticles: (spin?: Spin) => SpunParticleT<TransferrableTokensParticleT>[]; unallocatedTokensParticles: (spin?: Spin) => SpunParticleT<UnallocatedTokensParticleT>[]; tokenDefinitionParticleMatchingIdentifier: (resourceIdentifier: ResourceIdentifierT) => TokenDefinitionParticleBase | undefined; }>; export declare type SpunParticles = SpunParticleQueryable & Readonly<{ spunParticles: AnySpunParticle[]; }>; //# sourceMappingURL=_types.d.ts.map