0.0.1 • Published 6 months ago

satnames v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

CircleCI

Ordinals Sat Name Finder

This module allows you to derive the satellite name from ordinal satellite numbers. Additionally, it provides the ability to search for specific patterns in UTXOs within a given range.

Table of Contents

Quickstart

node

npm init -y
npm i satnames

index.mjs

import { SatNames } from 'satnames'

const satNames = new SatNames()
satNames.init()
const number = '1953186218210490'
const satName = satNames
    .toSatName( { 'satNumber': number } )
    .getSatName()

console.log( `Check out the sleepiest sat: ${satName}`)

.toSatName( {...} )

OptionDescriptionTypeRequired
satNumberThe satellite number for which you want to get the namestringtrue

Examples:

satNames
    .toSatName( { 'satNumber': '123' } )
    .getSatName()
import { SatNames } from 'satnames'

const satNames = new SatNames()
const result = satNames
    .init()
    .toSatName( { 'satNumber': '1953186218210490' } )
    .getSatName()

console.log( 'result', result )

.toSatNumber( {...} )

OptionDescriptionTypeRequired
satNameThe satellite name for which you want to get the numberstringtrue

Examples:

satNames
    .toSatNumber( { 'satNumber': '123' } )
    .getSatNUmber()
import { SatNames } from 'satnames'

const satNames = new SatNames()
const result = satNames
    .init()
    .toSatNumber( { 'satName': 'zzzzzzzzzz' } )
    .getSatNumber()

console.log( 'result', result )

.setSimplePattern( {...} )

OptionDescriptionTypeRequired
patternThe pattern or regular expression to search forstringtrue

With the .setSimplePattern( { 'pattern': 'abc' } ) method, you can easily perform searches. Since the search is performed using a regular expression, you can also input regex patterns like /abc/.

The following example checks whether the "sleepiest" ordinal has been found.

import { SatNames } from 'satnames'

const satNames = new SatNames()
satNames
    .init()
    .setSimplePattern( { 'pattern': 'zzzzzzzzzz' } )

const result = satNames
    .toSatName( { 'satNumber': '1953186218210490' } )
    .getPatternsForSatName()

console.log( 'result', result )

.setCustomPattern( { 'challenges': {...} )

Overview

Methods The following pattern methods are available:

MethodDescriptionOptions
inSuccessionSearch for patterns in succession{ 'startsWith' }, { 'endsWith' }
regularExpressionSearch using regular expressionsno options needed

Logic Under expect, you need to specify a logic, and the following cases are available for this purpose. Use value to set the value against which the result is checked.

CaseDescription
=Check if zeros is equal to value
>Check if zeros is greater than value
>=Check if zeros is greater than or equal to value
<Check if zeros is less than value
<=Check if zeros is less than or equal to value
DefaultDisplay an error message if the logic is not recognized

Example

You can add as many challenges as you like using .setCustomPattern( { 'challenges': [ {...} ] }. For this purpose, there are the methods inSuccession with the options startsWith and endsWith, or regularExpression, where no option is needed.

In the following example, a search is performed for names that start with more than 2 'a's at the beginning and end with 2 'a's. The second search looks for names that contain the letter sequence "abcdef" within them.

import { SatNames } from 'satnames'

const satNames = new SatNames()
satNames
    .init()
    .setCustomPattern( { 
        'challenges': [
            {
                'name': 'more a',
                'logic': [
                    {
                        'method': 'inSuccession',
                        'option': 'startsWith',
                        'value': 'a',
                        'expect': {
                            'logic': '>',
                            'value': 2
                        }
                    }
                    ,{
                        'method': 'inSuccession',
                        'option': 'endsWith',
                        'value': 'a',
                        'expect': {
                            'logic': '=',
                            'value': 2
                        }
                    }

                ]
            },
            {
                'name': 'myRegex',
                'logic': [
                    {
                        'method': 'regularExpression',
                        'value': 'abcdef',
                        'expect': {
                            'logic': '=',
                            'value': true
                        }
                    }
                ]
            }
        ] 
    } )

satNames
    .toSatName( { 'satNumber': '1953186218210490' } )
    .getPatternsForSatName()

console.log( 'result', result )

.getPatternsForSatRange( {...} )

OptionDescriptionTypeRequired
fromThe starting satellite numberstringtrue
toThe ending satellite numberstringtrue
satNames
    .init()
    .setSimplePattern( { 'pattern': 'zzzzzzzzzz' } )
    .getPatternsForSatRange( { 'from': '123', 'to': '134' } )
import { SatNames } from 'satnames'

const satNames = new SatNames()
satNames
    .init()
    .setSimplePattern( { 'pattern': 'zzzzzzzzzz' } )

const results = satNames
    .checkPatternsForSatRange( { 'from': 10, 'to': 130 } )

console.log( 'results', results )

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/satNames. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Limitations

  • Currently in Alpha Stage

Credits

License

The module is available as open source under the terms of the MIT.

Code of Conduct

Everyone interacting in the EasyMina project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

0.0.1

6 months ago