@nimiq/oasis-api
v1.1.1
Published
Typed Javascript library to access OASIS APIs from the browser.
Downloads
313
Readme
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
function init(url: string)
async function createHtlc(
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(id: string): Promise<Htlc>
async function settleHtlc(
id: string,
secret: string,
settlementJWS: string,
authorizationToken?: string,
): Promise<Htlc<HtlcStatus.SETTLED>>
async function sandboxMockClearHtlc(id: string): Promise<boolean>
async function exchangeAuthorizationToken(token: string): Promise<string>
Helper methods
function base64ToHex(base64: string): string
function hexToBase64(hex: string): string