@rust-nostr/nostr-sdk
Version:
Nostr protocol implementation, Relay, RelayPool, high-level client library, NWC client and more.
1,734 lines (1,659 loc) • 556 kB
JavaScript
let imports = {};
imports['__wbindgen_placeholder__'] = module.exports;
let wasm;
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
function addToExternrefTable0(obj) {
const idx = wasm.__wbindgen_export_1();
wasm.__wbindgen_export_2.set(idx, obj);
return idx;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
const idx = addToExternrefTable0(e);
wasm.__wbindgen_export_0(idx);
}
}
function isLikeNone(x) {
return x === undefined || x === null;
}
let WASM_VECTOR_LEN = 0;
let cachedTextEncoder = new TextEncoder('utf-8');
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
});
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(state => {
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
});
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
CLOSURE_DTORS.unregister(state);
} else {
state.a = a;
}
}
};
real.original = state;
CLOSURE_DTORS.register(real, state, state);
return real;
}
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
}
};
real.original = state;
CLOSURE_DTORS.register(real, state, state);
return real;
}
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
}
function getArrayJsValueFromWasm0(ptr, len) {
ptr = ptr >>> 0;
const mem = getDataViewMemory0();
const result = [];
for (let i = ptr; i < ptr + 4 * len; i += 4) {
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
}
wasm.__wbindgen_export_7(ptr, len);
return result;
}
function passArrayJsValueToWasm0(array, malloc) {
const ptr = malloc(array.length * 4, 4) >>> 0;
for (let i = 0; i < array.length; i++) {
const add = addToExternrefTable0(array[i]);
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
}
WASM_VECTOR_LEN = array.length;
return ptr;
}
function takeFromExternrefTable0(idx) {
const value = wasm.__wbindgen_export_2.get(idx);
wasm.__wbindgen_export_8(idx);
return value;
}
/**
* @param {LogLevel} level
*/
module.exports.initLogger = function(level) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(level, LogLevel);
var ptr0 = level.__destroy_into_raw();
wasm.initLogger(retptr, ptr0);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
if (r1) {
throw takeFromExternrefTable0(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* Encrypt (NIP04)
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @param {string} text
* @returns {string}
*/
module.exports.nip04Encrypt = function(secret_key, public_key, text) {
let deferred3_0;
let deferred3_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.nip04Encrypt(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr, ptr0, len0);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
var ptr2 = r0;
var len2 = r1;
if (r3) {
ptr2 = 0; len2 = 0;
throw takeFromExternrefTable0(r2);
}
deferred3_0 = ptr2;
deferred3_1 = len2;
return getStringFromWasm0(ptr2, len2);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
}
};
/**
* Decrypt (NIP04)
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @param {string} encrypted_content
* @returns {string}
*/
module.exports.nip04Decrypt = function(secret_key, public_key, encrypted_content) {
let deferred3_0;
let deferred3_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
const ptr0 = passStringToWasm0(encrypted_content, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.nip04Decrypt(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr, ptr0, len0);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
var ptr2 = r0;
var len2 = r1;
if (r3) {
ptr2 = 0; len2 = 0;
throw takeFromExternrefTable0(r2);
}
deferred3_0 = ptr2;
deferred3_1 = len2;
return getStringFromWasm0(ptr2, len2);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
}
};
/**
* Encrypt (NIP44)
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @param {string} content
* @param {NIP44Version} version
* @returns {string}
*/
module.exports.nip44Encrypt = function(secret_key, public_key, content, version) {
let deferred3_0;
let deferred3_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.nip44Encrypt(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr, ptr0, len0, version);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
var ptr2 = r0;
var len2 = r1;
if (r3) {
ptr2 = 0; len2 = 0;
throw takeFromExternrefTable0(r2);
}
deferred3_0 = ptr2;
deferred3_1 = len2;
return getStringFromWasm0(ptr2, len2);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
}
};
/**
* Decrypt (NIP44)
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @param {string} payload
* @returns {string}
*/
module.exports.nip44Decrypt = function(secret_key, public_key, payload) {
let deferred3_0;
let deferred3_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.nip44Decrypt(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr, ptr0, len0);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
var ptr2 = r0;
var len2 = r1;
if (r3) {
ptr2 = 0; len2 = 0;
throw takeFromExternrefTable0(r2);
}
deferred3_0 = ptr2;
deferred3_1 = len2;
return getStringFromWasm0(ptr2, len2);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
}
};
/**
* @param {ZapRequestData} data
* @returns {Event}
*/
module.exports.nip57AnonymousZapRequest = function(data) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(data, ZapRequestData);
wasm.nip57AnonymousZapRequest(retptr, data.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
if (r2) {
throw takeFromExternrefTable0(r1);
}
return Event.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {ZapRequestData} data
* @param {Keys} keys
* @returns {Event}
*/
module.exports.nip57PrivateZapRequest = function(data, keys) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(data, ZapRequestData);
_assertClass(keys, Keys);
wasm.nip57PrivateZapRequest(retptr, data.__wbg_ptr, keys.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
if (r2) {
throw takeFromExternrefTable0(r1);
}
return Event.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @param {Event} private_zap
* @returns {Event}
*/
module.exports.nip57DecryptSentPrivateZapMessage = function(secret_key, public_key, private_zap) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
_assertClass(private_zap, Event);
wasm.nip57DecryptSentPrivateZapMessage(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr, private_zap.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
if (r2) {
throw takeFromExternrefTable0(r1);
}
return Event.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {SecretKey} secret_key
* @param {Event} private_zap
* @returns {Event}
*/
module.exports.nip57DecryptReceivedPrivateZapMessage = function(secret_key, private_zap) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(private_zap, Event);
wasm.nip57DecryptReceivedPrivateZapMessage(retptr, secret_key.__wbg_ptr, private_zap.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
if (r2) {
throw takeFromExternrefTable0(r1);
}
return Event.__wrap(r0);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* @param {Event} event
* @returns {RelayListItem[]}
*/
module.exports.extractRelayList = function(event) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(event, Event);
wasm.extractRelayList(retptr, event.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Generate shared key
*
* **Important: use of a strong cryptographic hash function may be critical to security! Do NOT use
* unless you understand cryptographical implications.**
* @param {SecretKey} secret_key
* @param {PublicKey} public_key
* @returns {Uint8Array}
*/
module.exports.generateSharedKey = function(secret_key, public_key) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(secret_key, SecretKey);
_assertClass(public_key, PublicKey);
wasm.generateSharedKey(retptr, secret_key.__wbg_ptr, public_key.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
if (r3) {
throw takeFromExternrefTable0(r2);
}
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
/**
* Run some stuff when the Wasm module is instantiated.
*
* Right now, it does the following:
*
* * Redirect Rust panics to JavaScript console.
*/
module.exports.start = function() {
wasm.start();
};
/**
* @returns {string | undefined}
*/
module.exports.gitHashVersion = function() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.gitHashVersion(retptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
let v1;
if (r0 !== 0) {
v1 = getStringFromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
}
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
};
function __wbg_adapter_36(arg0, arg1, arg2) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.closure21_externref_shim(retptr, arg0, arg1, arg2);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
if (r1) {
throw takeFromExternrefTable0(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
function __wbg_adapter_39(arg0, arg1) {
wasm.__wbindgen_export_10(arg0, arg1);
}
function __wbg_adapter_42(arg0, arg1, arg2) {
wasm.closure224_externref_shim(arg0, arg1, arg2);
}
function __wbg_adapter_45(arg0, arg1) {
wasm.__wbindgen_export_12(arg0, arg1);
}
function __wbg_adapter_48(arg0, arg1, arg2) {
wasm.closure253_externref_shim(arg0, arg1, arg2);
}
function __wbg_adapter_1083(arg0, arg1, arg2, arg3) {
wasm.closure263_externref_shim(arg0, arg1, arg2, arg3);
}
/**
* @enum {0 | 1}
*/
module.exports.AdmitStatus = Object.freeze({
Success: 0, "0": "Success",
Rejected: 1, "1": "Rejected",
});
/**
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25}
*/
module.exports.Alphabet = Object.freeze({
A: 0, "0": "A",
B: 1, "1": "B",
C: 2, "2": "C",
D: 3, "3": "D",
E: 4, "4": "E",
F: 5, "5": "F",
G: 6, "6": "G",
H: 7, "7": "H",
I: 8, "8": "I",
J: 9, "9": "J",
K: 10, "10": "K",
L: 11, "11": "L",
M: 12, "12": "M",
N: 13, "13": "N",
O: 14, "14": "O",
P: 15, "15": "P",
Q: 16, "16": "Q",
R: 17, "17": "R",
S: 18, "18": "S",
T: 19, "19": "T",
U: 20, "20": "U",
V: 21, "21": "V",
W: 22, "22": "W",
X: 23, "23": "X",
Y: 24, "24": "Y",
Z: 25, "25": "Z",
});
/**
* @enum {0 | 1 | 2 | 3 | 4}
*/
module.exports.DataVendingMachineStatus = Object.freeze({
PaymentRequired: 0, "0": "PaymentRequired",
Processing: 1, "1": "Processing",
Error: 2, "2": "Error",
Success: 3, "3": "Success",
Partial: 4, "4": "Partial",
});
/**
* Encrypted Secret Key version (NIP49)
* @enum {0}
*/
module.exports.EncryptedSecretKeyVersion = Object.freeze({
V2: 0, "0": "V2",
});
/**
* Flag checks
* @enum {0 | 1}
*/
module.exports.FlagCheck = Object.freeze({
/**
* Use `OR` logic operator
*/
Any: 0, "0": "Any",
/**
* Use `AND` logic operator
*/
All: 1, "1": "All",
});
/**
* @enum {0 | 1 | 2 | 3}
*/
module.exports.HttpMethod = Object.freeze({
GET: 0, "0": "GET",
POST: 1, "1": "POST",
PUT: 2, "2": "PUT",
PATCH: 3, "3": "PATCH",
});
/**
* Key security
* @enum {0 | 1 | 2}
*/
module.exports.KeySecurity = Object.freeze({
/**
* The key has been known to have been handled insecurely (stored unencrypted, cut and paste unencrypted, etc)
*/
Weak: 0, "0": "Weak",
/**
* The key has NOT been known to have been handled insecurely (stored encrypted, cut and paste encrypted, etc)
*/
Medium: 1, "1": "Medium",
/**
* The client does not track this data
*/
Unknown: 2, "2": "Unknown",
});
/**
* Standardized kind
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83}
*/
module.exports.KindStandard = Object.freeze({
/**
* Metadata (NIP01 and NIP05)
*/
Metadata: 0, "0": "Metadata",
/**
* Short Text Note (NIP01)
*/
TextNote: 1, "1": "TextNote",
/**
* Contacts (NIP02)
*/
ContactList: 2, "2": "ContactList",
/**
* OpenTimestamps Attestations (NIP03)
*/
OpenTimestamps: 3, "3": "OpenTimestamps",
/**
* Event Deletion (NIP09)
*/
EventDeletion: 4, "4": "EventDeletion",
/**
* Repost (NIP18)
*/
Repost: 5, "5": "Repost",
/**
* Generic Repost (NIP18)
*/
GenericRepost: 6, "6": "GenericRepost",
/**
* Comment (NIP22)
*/
Comment: 7, "7": "Comment",
/**
* Reaction (NIP25)
*/
Reaction: 8, "8": "Reaction",
/**
* Badge Award (NIP58)
*/
BadgeAward: 9, "9": "BadgeAward",
/**
* Blossom Authorization
*/
BlossomAuth: 10, "10": "BlossomAuth",
/**
* Channel Creation (NIP28)
*/
ChannelCreation: 11, "11": "ChannelCreation",
/**
* Channel Metadata (NIP28)
*/
ChannelMetadata: 12, "12": "ChannelMetadata",
/**
* Channel Message (NIP28)
*/
ChannelMessage: 13, "13": "ChannelMessage",
/**
* Channel Hide Message (NIP28)
*/
ChannelHideMessage: 14, "14": "ChannelHideMessage",
/**
* Channel Mute User (NIP28)
*/
ChannelMuteUser: 15, "15": "ChannelMuteUser",
/**
* Git Patch
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitPatch: 16, "16": "GitPatch",
/**
* Git Issue
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitIssue: 17, "17": "GitIssue",
/**
* Git Reply
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitReply: 18, "18": "GitReply",
/**
* Open Status of Git Patch or Issue
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitStatusOpen: 19, "19": "GitStatusOpen",
/**
* Applied / Merged Status of Git Patch or Resolved Status of Git Issue
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitStatusApplied: 20, "20": "GitStatusApplied",
/**
* Closed Status of Git Patch or Issue
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitStatusClosed: 21, "21": "GitStatusClosed",
/**
* Draft Status of Git Patch or Issue
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitStatusDraft: 22, "22": "GitStatusDraft",
/**
* Torrent
*
* <https://github.com/nostr-protocol/nips/blob/master/35.md>
*/
Torrent: 23, "23": "Torrent",
/**
* Torrent comment
*
* <https://github.com/nostr-protocol/nips/blob/master/35.md>
*/
TorrentComment: 24, "24": "TorrentComment",
/**
* Label
*
* <https://github.com/nostr-protocol/nips/blob/master/32.md>
*/
Label: 25, "25": "Label",
/**
* Wallet Service Info (NIP47)
*/
WalletConnectInfo: 26, "26": "WalletConnectInfo",
/**
* Reporting (NIP56)
*/
Reporting: 27, "27": "Reporting",
/**
* Zap Private Message (NIP57)
*/
ZapPrivateMessage: 28, "28": "ZapPrivateMessage",
/**
* Zap Request (NIP57)
*/
ZapRequest: 29, "29": "ZapRequest",
/**
* Zap Receipt (NIP57)
*/
ZapReceipt: 30, "30": "ZapReceipt",
/**
* Mute List
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
MuteList: 31, "31": "MuteList",
/**
* Pin List
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
PinList: 32, "32": "PinList",
/**
* Bookmarks
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
Bookmarks: 33, "33": "Bookmarks",
/**
* Communities
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
Communities: 34, "34": "Communities",
/**
* Public Chats
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
PublicChats: 35, "35": "PublicChats",
/**
* Blocked Relays
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
BlockedRelays: 36, "36": "BlockedRelays",
/**
* Search Relays
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
SearchRelays: 37, "37": "SearchRelays",
/**
* Simple Groups
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
SimpleGroups: 38, "38": "SimpleGroups",
/**
* Interests
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
Interests: 39, "39": "Interests",
/**
* Emojis
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
Emojis: 40, "40": "Emojis",
/**
* Follow Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
FollowSet: 41, "41": "FollowSet",
/**
* Relay Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
RelaySet: 42, "42": "RelaySet",
/**
* Bookmark Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
BookmarkSet: 43, "43": "BookmarkSet",
/**
* Articles Curation Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
ArticlesCurationSet: 44, "44": "ArticlesCurationSet",
/**
* Videos Curation Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
VideosCurationSet: 45, "45": "VideosCurationSet",
/**
* Interest Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
InterestSet: 46, "46": "InterestSet",
/**
* Emoji Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
EmojiSet: 47, "47": "EmojiSet",
/**
* Release Artifact Set
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
ReleaseArtifactSet: 48, "48": "ReleaseArtifactSet",
/**
* Relay List Metadata (NIP65)
*/
RelayList: 49, "49": "RelayList",
/**
* Peer-to-peer Order events
*
* <https://github.com/nostr-protocol/nips/blob/master/69.md>
*/
PeerToPeerOrder: 50, "50": "PeerToPeerOrder",
/**
* Request to Vanish (NIP62)
*
* <https://github.com/nostr-protocol/nips/blob/master/62.md>
*/
RequestToVanish: 51, "51": "RequestToVanish",
/**
* Client Authentication (NIP42)
*/
Authentication: 52, "52": "Authentication",
/**
* Wallet Connect Request (NIP47)
*/
WalletConnectRequest: 53, "53": "WalletConnectRequest",
/**
* Wallet Connect Response (NIP47)
*/
WalletConnectResponse: 54, "54": "WalletConnectResponse",
WalletConnectNotification: 55, "55": "WalletConnectNotification",
/**
* Nostr Connect (NIP46)
*/
NostrConnect: 56, "56": "NostrConnect",
/**
* Live Event (NIP53)
*/
LiveEvent: 57, "57": "LiveEvent",
/**
* Live Event Message (NIP53)
*/
LiveEventMessage: 58, "58": "LiveEventMessage",
/**
* Profile Badges (NIP58)
*/
ProfileBadges: 59, "59": "ProfileBadges",
/**
* Badge Definition (NIP58)
*/
BadgeDefinition: 60, "60": "BadgeDefinition",
/**
* Seal (NIP59)
*/
Seal: 61, "61": "Seal",
/**
* Gift Wrap (NIP59)
*/
GiftWrap: 62, "62": "GiftWrap",
/**
* Private Direct message
*
* <https://github.com/nostr-protocol/nips/blob/master/17.md>
*/
PrivateDirectMessage: 63, "63": "PrivateDirectMessage",
/**
* Inbox Relays (NIP17)
*/
InboxRelays: 64, "64": "InboxRelays",
/**
* MLS Key Package Relays (NIP104)
*/
MlsKeyPackageRelays: 65, "65": "MlsKeyPackageRelays",
/**
* MLS Key Package (NIP104)
*/
MlsKeyPackage: 66, "66": "MlsKeyPackage",
/**
* MLS Welcome (NIP104)
*/
MlsWelcome: 67, "67": "MlsWelcome",
/**
* MLS Group Message (NIP104)
*/
MlsGroupMessage: 68, "68": "MlsGroupMessage",
/**
* Long-form Text Note (NIP23)
*/
LongFormTextNote: 69, "69": "LongFormTextNote",
/**
* Git Repository Announcement
*
* <https://github.com/nostr-protocol/nips/blob/master/34.md>
*/
GitRepoAnnouncement: 70, "70": "GitRepoAnnouncement",
/**
* Application-specific Data (NIP78)
*/
ApplicationSpecificData: 71, "71": "ApplicationSpecificData",
/**
* File Metadata (NIP94)
*/
FileMetadata: 72, "72": "FileMetadata",
/**
* HTTP Auth (NIP98)
*/
HttpAuth: 73, "73": "HttpAuth",
/**
* Set stall (NIP15)
*/
SetStall: 74, "74": "SetStall",
/**
* Set product (NIP15)
*/
SetProduct: 75, "75": "SetProduct",
/**
* Job Feedback (NIP90)
*/
JobFeedback: 76, "76": "JobFeedback",
/**
* User Status
*
* <https://github.com/nostr-protocol/nips/blob/master/38.md>
*/
UserStatus: 77, "77": "UserStatus",
/**
* Cashu Wallet
*
* <https://github.com/nostr-protocol/nips/blob/master/60.md>
*/
CashuWallet: 78, "78": "CashuWallet",
/**
* Cashu Wallet Unspent Proof
*
* <https://github.com/nostr-protocol/nips/blob/master/60.md>
*/
CashuWalletUnspentProof: 79, "79": "CashuWalletUnspentProof",
/**
* Cashu Wallet Spending History
*
* <https://github.com/nostr-protocol/nips/blob/master/60.md>
*/
CashuWalletSpendingHistory: 80, "80": "CashuWalletSpendingHistory",
/**
* Code Snippet
*
* <https://github.com/nostr-protocol/nips/blob/master/C0.md>
*/
CodeSnippet: 81, "81": "CodeSnippet",
Poll: 82, "82": "Poll",
PollResponse: 83, "83": "PollResponse",
});
/**
* @enum {2}
*/
module.exports.NIP44Version = Object.freeze({
V2: 2, "2": "V2",
});
/**
* NIP47 Response Error codes
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}
*/
module.exports.Nip47ErrorCode = Object.freeze({
/**
* The client is sending commands too fast.
*/
RateLimited: 0, "0": "RateLimited",
/**
* The command is not known of is intentionally not implemented
*/
NotImplemented: 1, "1": "NotImplemented",
/**
* The wallet does not have enough funds to cover a fee reserve or the payment amount
*/
InsufficientBalance: 2, "2": "InsufficientBalance",
/**
* The payment failed. This may be due to a timeout, exhausting all routes, insufficient capacity or similar.
*/
PaymentFailed: 3, "3": "PaymentFailed",
/**
* The invoice could not be found by the given parameters.
*/
NotFound: 4, "4": "NotFound",
/**
* The wallet has exceeded its spending quota
*/
QuotaExceeded: 5, "5": "QuotaExceeded",
/**
* This public key is not allowed to do this operation
*/
Restricted: 6, "6": "Restricted",
/**
* This public key has no wallet connected
*/
Unauthorized: 7, "7": "Unauthorized",
/**
* An internal error
*/
Internal: 8, "8": "Internal",
/**
* Other error
*/
Other: 9, "9": "Other",
});
/**
* @enum {0 | 1}
*/
module.exports.RelayMetadata = Object.freeze({
Read: 0, "0": "Read",
Write: 1, "1": "Write",
});
/**
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
*/
module.exports.RelayStatus = Object.freeze({
/**
* Initialized
*/
Initialized: 0, "0": "Initialized",
/**
* Pending
*/
Pending: 1, "1": "Pending",
/**
* Connecting
*/
Connecting: 2, "2": "Connecting",
/**
* Connected
*/
Connected: 3, "3": "Connected",
/**
* Disconnected, will retry to connect again
*/
Disconnected: 4, "4": "Disconnected",
/**
* Completely disconnected
*/
Terminated: 5, "5": "Terminated",
/**
* The relay has been banned.
*/
Banned: 6, "6": "Banned",
/**
* Relay is sleeping
*/
Sleeping: 7, "7": "Sleeping",
});
/**
* Report
*
* <https://github.com/nostr-protocol/nips/blob/master/56.md>
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
*/
module.exports.Report = Object.freeze({
/**
* Depictions of nudity, porn, etc
*/
Nudity: 0, "0": "Nudity",
/**
* Virus, trojan horse, worm, robot, spyware, adware, back door, ransomware, rootkit, kidnapper, etc.
*/
Malware: 1, "1": "Malware",
/**
* Profanity, hateful speech, etc.
*/
Profanity: 2, "2": "Profanity",
/**
* Something which may be illegal in some jurisdiction
*/
Illegal: 3, "3": "Illegal",
/**
* Spam
*/
Spam: 4, "4": "Spam",
/**
* Someone pretending to be someone else
*/
Impersonation: 5, "5": "Impersonation",
/**
* Reports that don't fit in the above categories
*/
Other: 6, "6": "Other",
});
/**
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}
*/
module.exports.SaveEventStatus = Object.freeze({
/**
* The event has been successfully saved into the database
*/
Success: 0, "0": "Success",
/**
* Ephemeral events aren't expected to be stored
*/
Ephemeral: 1, "1": "Ephemeral",
/**
* The event already exists
*/
Duplicate: 2, "2": "Duplicate",
/**
* The event was deleted
*/
Deleted: 3, "3": "Deleted",
/**
* The event is expired
*/
Expired: 4, "4": "Expired",
/**
* The event was replaced
*/
Replaced: 5, "5": "Replaced",
/**
* Attempt to delete a non-owned event
*/
InvalidDelete: 6, "6": "InvalidDelete",
/**
* Other reason
*/
Other: 7, "7": "Other",
});
/**
* @enum {0 | 1 | 2}
*/
module.exports.SyncDirection = Object.freeze({
Up: 0, "0": "Up",
Down: 1, "1": "Down",
Both: 2, "2": "Both",
});
/**
* Transaction State
* @enum {0 | 1 | 2 | 3}
*/
module.exports.TransactionState = Object.freeze({
/**
* Pending
*/
Pending: 0, "0": "Pending",
/**
* Settled
*/
Settled: 1, "1": "Settled",
/**
* Expired (for invoices)
*/
Expired: 2, "2": "Expired",
/**
* Failed (for payments)
*/
Failed: 3, "3": "Failed",
});
/**
* Transaction Type
* @enum {0 | 1}
*/
module.exports.TransactionType = Object.freeze({
/**
* Incoming payments
*/
Incoming: 0, "0": "Incoming",
/**
* Outgoing payments
*/
Outgoing: 1, "1": "Outgoing",
});
/**
* @enum {0 | 1 | 2}
*/
module.exports.ZapType = Object.freeze({
/**
* Public
*/
Public: 0, "0": "Public",
/**
* Private
*/
Private: 1, "1": "Private",
/**
* Anonymous
*/
Anonymous: 2, "2": "Anonymous",
});
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
const __wbindgen_enum_IdbRequestReadyState = ["pending", "done"];
const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
const AbortHandleFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_aborthandle_free(ptr >>> 0, 1));
class AbortHandle {
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(AbortHandle.prototype);
obj.__wbg_ptr = ptr;
AbortHandleFinalization.register(obj, obj.__wbg_ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
AbortHandleFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_aborthandle_free(ptr, 0);
}
/**
* Abort thread
*/
abort() {
wasm.aborthandle_abort(this.__wbg_ptr);
}
/**
* Check if thread is aborted
* @returns {boolean}
*/
is_aborted() {
const ret = wasm.aborthandle_is_aborted(this.__wbg_ptr);
return ret !== 0;
}
}
module.exports.AbortHandle = AbortHandle;
const Aes256GcmFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_aes256gcm_free(ptr >>> 0, 1));
class Aes256Gcm {
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(Aes256Gcm.prototype);
obj.__wbg_ptr = ptr;
Aes256GcmFinalization.register(obj, obj.__wbg_ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
Aes256GcmFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_aes256gcm_free(ptr, 0);
}
/**
* @returns {string}
*/
get key() {
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_aes256gcm_key(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
deferred1_0 = r0;
deferred1_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
}
}
/**
* @param {string} arg0
*/
set key(arg0) {
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.__wbg_set_aes256gcm_key(this.__wbg_ptr, ptr0, len0);
}
/**
* @returns {string}
*/
get iv() {
let deferred1_0;
let deferred1_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_aes256gcm_iv(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
deferred1_0 = r0;
deferred1_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
}
}
/**
* @param {string} arg0
*/
set iv(arg0) {
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
wasm.__wbg_set_aes256gcm_iv(this.__wbg_ptr, ptr0, len0);
}
/**
* @param {string} key
* @param {string} iv
*/
constructor(key, iv) {
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(iv, wasm.__wbindgen_export_4, wasm.__wbindgen_export_5);
const len1 = WASM_VECTOR_LEN;
const ret = wasm.aes256gcm_new(ptr0, len0, ptr1, len1);
this.__wbg_ptr = ret >>> 0;
Aes256GcmFinalization.register(this, this.__wbg_ptr, this);
return this;
}
}
module.exports.Aes256Gcm = Aes256Gcm;
const ArticlesCurationFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_articlescuration_free(ptr >>> 0, 1));
/**
* Groups of articles picked by users as interesting and/or belonging to the same category
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
class ArticlesCuration {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
ArticlesCurationFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_articlescuration_free(ptr, 0);
}
/**
* @returns {Coordinate[]}
*/
get coordinate() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_articlescuration_coordinate(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {Coordinate[]} arg0
*/
set coordinate(arg0) {
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_export_4);
const len0 = WASM_VECTOR_LEN;
wasm.__wbg_set_articlescuration_coordinate(this.__wbg_ptr, ptr0, len0);
}
/**
* @returns {EventId[]}
*/
get event_ids() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_articlescuration_event_ids(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {EventId[]} arg0
*/
set event_ids(arg0) {
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_export_4);
const len0 = WASM_VECTOR_LEN;
wasm.__wbg_set_articlescuration_event_ids(this.__wbg_ptr, ptr0, len0);
}
constructor() {
const ret = wasm.articlescuration_new();
this.__wbg_ptr = ret >>> 0;
ArticlesCurationFinalization.register(this, this.__wbg_ptr, this);
return this;
}
}
module.exports.ArticlesCuration = ArticlesCuration;
const AtomicRelayServiceFlagsFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_atomicrelayserviceflags_free(ptr >>> 0, 1));
class AtomicRelayServiceFlags {
static __wrap(ptr) {
ptr = ptr >>> 0;
const obj = Object.create(AtomicRelayServiceFlags.prototype);
obj.__wbg_ptr = ptr;
AtomicRelayServiceFlagsFinalization.register(obj, obj.__wbg_ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
AtomicRelayServiceFlagsFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_atomicrelayserviceflags_free(ptr, 0);
}
/**
* @param {RelayServiceFlags} flags
* @returns {AtomicRelayServiceFlags}
*/
static new(flags) {
_assertClass(flags, RelayServiceFlags);
const ret = wasm.atomicrelayserviceflags_new(flags.__wbg_ptr);
return AtomicRelayServiceFlags.__wrap(ret);
}
/**
* @param {RelayServiceFlags} flags
*/
add(flags) {
_assertClass(flags, RelayServiceFlags);
wasm.atomicrelayserviceflags_add(this.__wbg_ptr, flags.__wbg_ptr);
}
/**
* @param {RelayServiceFlags} flags
*/
remove(flags) {
_assertClass(flags, RelayServiceFlags);
wasm.atomicrelayserviceflags_remove(this.__wbg_ptr, flags.__wbg_ptr);
}
/**
* Check whether `RelayServiceFlags` are included in this one.
* @param {RelayServiceFlags} flags
* @param {FlagCheck} check
* @returns {boolean}
*/
has(flags, check) {
_assertClass(flags, RelayServiceFlags);
const ret = wasm.atomicrelayserviceflags_has(this.__wbg_ptr, flags.__wbg_ptr, check);
return ret !== 0;
}
/**
* Check if `READ` service is enabled
* @returns {boolean}
*/
has_read() {
const ret = wasm.atomicrelayserviceflags_has_read(this.__wbg_ptr);
return ret !== 0;
}
/**
* Check if `WRITE` service is enabled
* @returns {boolean}
*/
has_write() {
const ret = wasm.atomicrelayserviceflags_has_write(this.__wbg_ptr);
return ret !== 0;
}
/**
* Check if `PING` service is enabled
* @returns {boolean}
*/
has_ping() {
const ret = wasm.atomicrelayserviceflags_has_ping(this.__wbg_ptr);
return ret !== 0;
}
}
module.exports.AtomicRelayServiceFlags = AtomicRelayServiceFlags;
const BookmarksFinalization = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(ptr => wasm.__wbg_bookmarks_free(ptr >>> 0, 1));
/**
* Uncategorized, "global" list of things a user wants to save
*
* <https://github.com/nostr-protocol/nips/blob/master/51.md>
*/
class Bookmarks {
__destroy_into_raw() {
const ptr = this.__wbg_ptr;
this.__wbg_ptr = 0;
BookmarksFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_bookmarks_free(ptr, 0);
}
/**
* @returns {EventId[]}
*/
get event_ids() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_bookmarks_event_ids(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
return v1;
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {EventId[]} arg0
*/
set event_ids(arg0) {
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_export_4);
const len0 = WASM_VECTOR_LEN;
wasm.__wbg_set_bookmarks_event_ids(this.__wbg_ptr, ptr0, len0);
}
/**
* @returns {Coordinate[]}
*/
get coordinate() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.__wbg_get_bookmarks_coordinate(retptr, this.__wbg_ptr);
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
var r1 = getDataViewMemory0().getInt32(retptr + 4