Skip to content

Typed Javascript library to access OASIS APIs from the browser.

Notifications You must be signed in to change notification settings

nimiq/oasis-api-js

Repository files navigation

OASIS API for Javascript, typed

A simple ES5 library to interact with the OASIS API.

Package

This package can be installed from NPM as

@nimiq/oasis-api

https://www.npmjs.com/package/@nimiq/oasis-api

API

async function createHtlc(
    API_URL: string,
    contract: {
        asset: Asset,
        amount: number,
        beneficiary: OctetKeyPair | EllipticCurveKey,
        hash: {
            algorithm: 'sha256' | 'blake2b',
            value: string,
        },
        preimage: {
            size: 32,
        },
        expires: number,
        includeFee: boolean,
    },
    authorizationToken?: string,
): Promise<Htlc<HtlcStatus.PENDING>>
async function getHtlc(API_URL: string, id: string): Promise<Htlc>
async function settleHtlc(
    API_URL: string,
    id: string,
    secret: string,
    settlementJWS: string,
    authorizationToken?: string,
): Promise<Htlc<HtlcStatus.SETTLED>>
async function sandboxMockClearHtlc(API_URL: string, id: string): Promise<boolean>
async function exchangeAuthorizationToken(API_URL: string, token: string): Promise<string>

Helper methods

function base64ToHex(base64: string): string
function hexToBase64(hex: string): string

About

Typed Javascript library to access OASIS APIs from the browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published