0.1.3 • Published 2 years ago

iota-url-parser v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

iota-url-parser

iota-url-parser CI

A module that supports parsing and building of IOTA deep links.

Getting Started

# NPM
npm install iota-url-parser

# Yarn
yarn install iota-url-parser

Using the Library

The library contains two functions:

parse(uri)

Parses an IOTA deep link for its various properties, namely protocol, context, operation, and any specific arguments or parameters.

import { parse } from 'iota-url-parser'

const parseResult = parse('iota://wallet/send/atoi1qzallu8y7jhglsc6n93qx8u3lfv3nwagju7xh7al2y7rwwt7f4vsuda9rg5?amount=51&unit=Gi')
console.log(parseResult)
// {
//     protocol: 'iota',
//     context: 'wallet',
//     operation: 'send',
//     argument: 'atoi1qzallu8y7jhglsc6n93qx8u3lfv3nwagju7xh7al2y7rwwt7f4vsuda9rg5',
//     parameters: { amount: 51, unit: 'Gi' }
// }

build(protocol, context, operation, argument, parameters)

Assemble an IOTA deep link URL given a few parameters.

import { build } from 'iota-url-parser'

const buildResult = build(
    'iota',
    'wallet', 
    'send', 
    'atoi1qzallu8y7jhglsc6n93qx8u3lfv3nwagju7xh7al2y7rwwt7f4vsuda9rg5', 
    { amount: 51, unit: 'Gi' }
)
console.log(buildResult)
// iota://wallet/send/atoi1qzallu8y7jhglsc6n93qx8u3lfv3nwagju7xh7al2y7rwwt7f4vsuda9rg5?amount=51&unit=Gi
0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago