A simple ES5 library to interact with the OASIS API.
This package can be installed from NPM as
@nimiq/oasis-api
https://www.npmjs.com/package/@nimiq/oasis-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>
function base64ToHex(base64: string): string
function hexToBase64(hex: string): string