0.0.42 • Published 1 year ago
@polymedia/suits v0.0.42
Polymedia SuiTS
Sui TypeScript utilities.
Usage
Add SuiTS to your project:
pnpm add @polymedia/suits
Use it in your code, for example:
import { validateAndNormalizeSuiAddress } from '@polymedia/suits';
Exports
Constants
const ADDRESS_REGEX
- Regular expression to match a normalized Sui address.
Types
type NetworkName
- A Sui network name (mainnet/testnet/devnet/localnet).type SuiExplorerItem
- A Polymedia Explorer item type (address/object/package/txblock).
API functions
function apiRequestIndexer
- Make a request to the Indexer.xyz API (NFTs).
Sui functions
function devInspectAndGetResults
- CallSuiClient.devInspectTransactionBlock()
and return the results.function devInspectAndGetReturnValues
- CallSuiClient.devInspectTransactionBlock()
and return the deserialized return values.function fetchAllDynamicFields
- Get all dynamic object fields owned by an object.function generateRandomAddress
- Generate a random Sui address (for development only).function getCoinOfValue
- Get aCoin<T>
of a given value from the owner. Handles coin merging and splitting.function getSuiObjectResponseFields
- Validate a SuiObjectResponse and return its content.function makeExplorerUrl
- Build a Polymedia Explorer URL.function removeLeadingZeros
- Remove leading zeros from a Sui address (lossless).function requestSuiFromFaucet
- Get SUI from the faucet on localnet/devnet/testnet.function shortenSuiAddress
- Abbreviate a Sui address for display purposes (lossy).function validateAndNormalizeSuiAddress
- Validate a Sui address and return its normalized form, ornull
if invalid.
Classes
class SuiEventFetcher
- A tool to fetch the latest Sui events and parse them into custom objects.function fetchEvents
- Fetch the latest events. Every time the function is called it looks for events that took place since the last call.
class SuiMultiClient
- A tool to make many RPC requests using multiple endpoints.function executeInBatches
- ExecuteSuiClient
RPC operations in parallel using multiple endpoints.function testEndpoints
- Test the latency of various Sui RPC endpoints.
Misc functions
function chunkArray
- Split an array into multiple chunks of a certain size.function convertNumberToBigInt
- Convert a number to a bigint, scaled to the specified decimals.function convertBigIntToNumber
- Convert a bigint to a number, scaled down to the specified decimals.function formatBigInt
- Format a bigint into a readable string, scaled down to the specified decimals.function formatNumber
- Format a number into a readable string.function log
- Log a message including the current date and time.function makeRanges
- Generate an array of ranges of a certain size between two numbers.function sleep
- Wait for a number of milliseconds.
0.0.42
1 year ago
0.0.41
1 year ago
0.0.40
1 year ago
0.0.39
1 year ago
0.0.38
1 year ago
0.0.37
1 year ago
0.0.36
1 year ago
0.0.35
1 year ago
0.0.34
1 year ago
0.0.32
1 year ago
0.0.33
1 year ago
0.0.31
1 year ago
0.0.30
1 year ago
0.0.28
1 year ago
0.0.29
1 year ago
0.0.26
1 year ago
0.0.27
1 year ago
0.0.25
1 year ago
0.0.21
1 year ago
0.0.22
1 year ago
0.0.23
1 year ago
0.0.24
1 year ago
0.0.20
1 year ago
0.0.19
1 year ago
0.0.18
1 year ago
0.0.17
1 year ago
0.0.16
1 year ago
0.0.14
1 year ago
0.0.15
1 year ago
0.0.13
1 year ago
0.0.11
1 year ago
0.0.12
1 year ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.6
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago