npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@projectsophon/serde

v0.1.3

Published

This package contains serializers and deserializers for converting between various representations of Dark Forest data, for example between raw data received from blockchain calls to Dark Forest contracts and the typescript types used across the client.

Downloads

1

Readme

@projectsophon/serde

This package contains serializers and deserializers for converting between various representations of Dark Forest data, for example between raw data received from blockchain calls to Dark Forest contracts and the typescript types used across the client.

Installation

You can install this package using npm or yarn by running:

npm install --save @projectsophon/serde
yarn add @projectsophon/serde

When using this in a plugin, you might want to load it with skypack

import * as serde from 'http://cdn.skypack.dev/@projectsophon/serde'

Table of contents

Functions

Functions

address

address(str): EthAddress

Converts a string to an EthAddress: a 0x-prefixed all lowercase hex string of 40 hex characters. An object of the EthAddress type should only ever be initialized through this constructor-like method. Throws if the provided string cannot be parsed as an Ethereum address.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | str | string | An address-like string |

Returns

EthAddress


hashToInt

hashToInt(hash): number

Parameters

| Name | Type | | :------ | :------ | | hash | string |

Returns

number


isNetworkEvent

isNetworkEvent(event): event is NetworkEvent

Returns whether or not the given event is an instance of NetworkEvent. Not super stringent but works for now.

Parameters

| Name | Type | | :------ | :------ | | event | any |

Returns

event is NetworkEvent


isUnconfirmedActivateArtifact

isUnconfirmedActivateArtifact(txIntent): txIntent is UnconfirmedActivateArtifact

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedActivateArtifact


isUnconfirmedActivateArtifactTx

isUnconfirmedActivateArtifactTx(tx): tx is Transaction<UnconfirmedActivateArtifact>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedActivateArtifact>


isUnconfirmedBuyHat

isUnconfirmedBuyHat(txIntent): txIntent is UnconfirmedBuyHat

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedBuyHat


isUnconfirmedBuyHatTx

isUnconfirmedBuyHatTx(tx): tx is Transaction<UnconfirmedBuyHat>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedBuyHat>


isUnconfirmedCapturePlanet

isUnconfirmedCapturePlanet(txIntent): txIntent is UnconfirmedCapturePlanet

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedCapturePlanet


isUnconfirmedCapturePlanetTx

isUnconfirmedCapturePlanetTx(tx): tx is Transaction<UnconfirmedCapturePlanet>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedCapturePlanet>


isUnconfirmedDeactivateArtifact

isUnconfirmedDeactivateArtifact(txIntent): txIntent is UnconfirmedDeactivateArtifact

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedDeactivateArtifact


isUnconfirmedDeactivateArtifactTx

isUnconfirmedDeactivateArtifactTx(tx): tx is Transaction<UnconfirmedDeactivateArtifact>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedDeactivateArtifact>


isUnconfirmedDepositArtifact

isUnconfirmedDepositArtifact(txIntent): txIntent is UnconfirmedDepositArtifact

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedDepositArtifact


isUnconfirmedDepositArtifactTx

isUnconfirmedDepositArtifactTx(tx): tx is Transaction<UnconfirmedDepositArtifact>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedDepositArtifact>


isUnconfirmedFindArtifact

isUnconfirmedFindArtifact(txIntent): txIntent is UnconfirmedFindArtifact

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedFindArtifact


isUnconfirmedFindArtifactTx

isUnconfirmedFindArtifactTx(tx): tx is Transaction<UnconfirmedFindArtifact>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedFindArtifact>


isUnconfirmedGetShips

isUnconfirmedGetShips(txIntent): txIntent is UnconfirmedGetShips

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedGetShips


isUnconfirmedGetShipsTx

isUnconfirmedGetShipsTx(tx): tx is Transaction<UnconfirmedGetShips>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedGetShips>


isUnconfirmedInit

isUnconfirmedInit(txIntent): txIntent is UnconfirmedInit

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedInit


isUnconfirmedInitTx

isUnconfirmedInitTx(tx): tx is Transaction<UnconfirmedInit>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedInit>


isUnconfirmedInvadePlanet

isUnconfirmedInvadePlanet(txIntent): txIntent is UnconfirmedInvadePlanet

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedInvadePlanet


isUnconfirmedInvadePlanetTx

isUnconfirmedInvadePlanetTx(tx): tx is Transaction<UnconfirmedInvadePlanet>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedInvadePlanet>


isUnconfirmedMove

isUnconfirmedMove(txIntent): txIntent is UnconfirmedMove

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedMove


isUnconfirmedMoveTx

isUnconfirmedMoveTx(tx): tx is Transaction<UnconfirmedMove>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedMove>


isUnconfirmedProspectPlanet

isUnconfirmedProspectPlanet(txIntent): txIntent is UnconfirmedProspectPlanet

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedProspectPlanet


isUnconfirmedProspectPlanetTx

isUnconfirmedProspectPlanetTx(tx): tx is Transaction<UnconfirmedProspectPlanet>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedProspectPlanet>


isUnconfirmedRelease

isUnconfirmedRelease(txIntent): txIntent is UnconfirmedMove

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedMove


isUnconfirmedReleaseTx

isUnconfirmedReleaseTx(tx): tx is Transaction<UnconfirmedMove>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedMove>


isUnconfirmedReveal

isUnconfirmedReveal(txIntent): txIntent is UnconfirmedReveal

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedReveal


isUnconfirmedRevealTx

isUnconfirmedRevealTx(tx): tx is Transaction<UnconfirmedReveal>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedReveal>


isUnconfirmedTransfer

isUnconfirmedTransfer(txIntent): txIntent is UnconfirmedPlanetTransfer

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedPlanetTransfer


isUnconfirmedTransferTx

isUnconfirmedTransferTx(tx): tx is Transaction<UnconfirmedPlanetTransfer>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedPlanetTransfer>


isUnconfirmedUpgrade

isUnconfirmedUpgrade(txIntent): txIntent is UnconfirmedUpgrade

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedUpgrade


isUnconfirmedUpgradeTx

isUnconfirmedUpgradeTx(tx): tx is Transaction<UnconfirmedUpgrade>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedUpgrade>


isUnconfirmedWithdrawArtifact

isUnconfirmedWithdrawArtifact(txIntent): txIntent is UnconfirmedWithdrawArtifact

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedWithdrawArtifact


isUnconfirmedWithdrawArtifactTx

isUnconfirmedWithdrawArtifactTx(tx): tx is Transaction<UnconfirmedWithdrawArtifact>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedWithdrawArtifact>


isUnconfirmedWithdrawSilver

isUnconfirmedWithdrawSilver(txIntent): txIntent is UnconfirmedWithdrawSilver

Parameters

| Name | Type | | :------ | :------ | | txIntent | TxIntent |

Returns

txIntent is UnconfirmedWithdrawSilver


isUnconfirmedWithdrawSilverTx

isUnconfirmedWithdrawSilverTx(tx): tx is Transaction<UnconfirmedWithdrawSilver>

Parameters

| Name | Type | | :------ | :------ | | tx | Transaction<TxIntent> |

Returns

tx is Transaction<UnconfirmedWithdrawSilver>


locationIdFromBigInt

locationIdFromBigInt(location): LocationId

Converts a BigInteger representation of location ID into a LocationID: a non-0x-prefixed all lowercase hex string of exactly 64 hex characters (0-padded). LocationIDs should only be instantiated through locationIdFromHexStr, locationIdFromDecStr, locationIdFromBigInt, and locationIdFromEthersBN.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | location | bigint | BigInteger representation of a location ID. |

Returns

LocationId


locationIdFromDecStr

locationIdFromDecStr(location): LocationId

Converts a string representing a decimal number into a LocationID: a non-0x-prefixed all lowercase hex string of exactly 64 hex characters (0-padded if necessary). LocationIDs should only be instantiated through locationIdFromHexStr, locationIdFromDecStr, locationIdFromBigInt, and locationIdFromEthersBN.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | location | string | string of decimal digits, the base 10 representation of a location ID. |

Returns

LocationId


locationIdFromEthersBN

locationIdFromEthersBN(location): LocationId

Converts an ethers.js BigNumber (type aliased here as EthersBN) representation of a location ID into a LocationID: a non-0x-prefixed all lowercase hex string of exactly 64 hex characters (0-padded). LocationIDs should only be instantiated through locationIdFromHexStr, locationIdFromDecStr, locationIdFromBigInt, and locationIdFromEthersBN.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | location | BigNumber | ethers.js BigNumber representation of a locationID. |

Returns

LocationId


locationIdFromHexStr

locationIdFromHexStr(location): LocationId

Converts a possibly 0x-prefixed string of hex digits to a LocationId: a non-0x-prefixed all lowercase hex string of exactly 64 hex characters (0-padded if necessary). LocationIDs should only be instantiated through locationIdFromHexStr, locationIdFromDecStr, locationIdFromBigInt, and locationIdFromEthersBN.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | location | string | A possibly 0x-prefixed string of hex digits representing a location ID. |

Returns

LocationId


locationIdToDecStr

locationIdToDecStr(locationId): string

Converts a LocationID to a decimal string with the same numerical value; can be used if you need to pass an artifact ID into a web3 call.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | locationId | LocationId | LocationID to convert into a string of decimal digits |

Returns

string