Add docs for blossom, add nip 86 and 98 support

This commit is contained in:
Jon Staab
2025-06-10 13:18:03 -07:00
parent 90b2ab2974
commit 4cabf53c2f
13 changed files with 314 additions and 17 deletions
+16 -1
View File
@@ -1321,7 +1321,10 @@ export const postJson = async <T>(url: string, data: T, opts: FetchOpts = {}) =>
opts.headers = {}
}
opts.headers["Content-Type"] = "application/json"
if (!opts.headers["Content-Type"]) {
opts.headers["Content-Type"] = "application/json"
}
opts.body = JSON.stringify(data)
return fetchJson(url, opts)
@@ -1562,6 +1565,10 @@ export const hexToBech32 = (prefix: string, hex: string) =>
export const bech32ToHex = (b32: string) =>
utf8.encode(bech32.fromWords(bech32.decode(b32 as any, false).words))
// ----------------------------------------------------------------------------
// Bytes <-> hex encoding
// ----------------------------------------------------------------------------
/**
* Converts an array buffer or Uint8Array to hex format
* @param buffer - ArrayBuffer or Uint8Array to convert
@@ -1585,6 +1592,14 @@ export const bytesToHex = (buffer: ArrayBuffer | Uint8Array) => {
export const hexToBytes = (hex: string) =>
new Uint8Array(hex.match(/.{2}/g)!.map(hex => parseInt(hex, 16)))
// ----------------------------------------------------------------------------
// Binary data
// ----------------------------------------------------------------------------
export const textEncoder = new TextEncoder()
export const textDecoder = new TextDecoder()
/**
* Computes SHA-256 hash of binary data
* @param data - Binary data to hash