Skip to content

Commit 7d372e4

Browse files
committed
Update auto-generated TypeScript Bindings
1 parent d87886b commit 7d372e4

File tree

277 files changed

+27341
-25744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+27341
-25744
lines changed

ts/bindings.c

Lines changed: 3847 additions & 3538 deletions
Large diffs are not rendered by default.

ts/bindings.c.body

Lines changed: 3847 additions & 3538 deletions
Large diffs are not rendered by default.

ts/bindings.mts

Lines changed: 17300 additions & 16403 deletions
Large diffs are not rendered by default.

ts/structs/APIError.mts

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -279,32 +279,22 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
279279

280280
import CommonBase from './CommonBase.mjs';
281281
import * as bindings from '../bindings.mjs'
282-
import * as InternalUtils from '../InternalUtils.mjs'
283282

284283
export class APIError extends CommonBase {
285284
protected constructor(_dummy: object, ptr: number) { super(ptr, bindings.APIError_free); }
286285
/* @internal */
287286
public static constr_from_ptr(ptr: number): APIError {
288-
const raw_val: bindings.LDKAPIError = bindings.LDKAPIError_ref_from_ptr(ptr);
289-
if (raw_val instanceof bindings.LDKAPIError_APIMisuseError) {
290-
return new APIError_APIMisuseError(ptr, raw_val);
287+
const raw_ty: number = bindings.LDKAPIError_ty_from_ptr(ptr);
288+
switch (raw_ty) {
289+
case 0: return new APIError_APIMisuseError(ptr);
290+
case 1: return new APIError_FeeRateTooHigh(ptr);
291+
case 2: return new APIError_RouteError(ptr);
292+
case 3: return new APIError_ChannelUnavailable(ptr);
293+
case 4: return new APIError_MonitorUpdateFailed(ptr);
294+
case 5: return new APIError_IncompatibleShutdownScript(ptr);
295+
default:
296+
throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
291297
}
292-
if (raw_val instanceof bindings.LDKAPIError_FeeRateTooHigh) {
293-
return new APIError_FeeRateTooHigh(ptr, raw_val);
294-
}
295-
if (raw_val instanceof bindings.LDKAPIError_RouteError) {
296-
return new APIError_RouteError(ptr, raw_val);
297-
}
298-
if (raw_val instanceof bindings.LDKAPIError_ChannelUnavailable) {
299-
return new APIError_ChannelUnavailable(ptr, raw_val);
300-
}
301-
if (raw_val instanceof bindings.LDKAPIError_MonitorUpdateFailed) {
302-
return new APIError_MonitorUpdateFailed(ptr, raw_val);
303-
}
304-
if (raw_val instanceof bindings.LDKAPIError_IncompatibleShutdownScript) {
305-
return new APIError_IncompatibleShutdownScript(ptr, raw_val);
306-
}
307-
throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
308298
}
309299

310300
public clone_ptr(): number {
@@ -319,29 +309,29 @@ export class APIError extends CommonBase {
319309
return ret_hu_conv;
320310
}
321311

322-
public static constructor_apimisuse_error(err: String): APIError {
323-
const ret: number = bindings.APIError_apimisuse_error(err);
312+
public static constructor_apimisuse_error(err: string): APIError {
313+
const ret: number = bindings.APIError_apimisuse_error(bindings.encodeString(err));
324314
const ret_hu_conv: APIError = APIError.constr_from_ptr(ret);
325315
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
326316
return ret_hu_conv;
327317
}
328318

329-
public static constructor_fee_rate_too_high(err: String, feerate: number): APIError {
330-
const ret: number = bindings.APIError_fee_rate_too_high(err, feerate);
319+
public static constructor_fee_rate_too_high(err: string, feerate: number): APIError {
320+
const ret: number = bindings.APIError_fee_rate_too_high(bindings.encodeString(err), feerate);
331321
const ret_hu_conv: APIError = APIError.constr_from_ptr(ret);
332322
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
333323
return ret_hu_conv;
334324
}
335325

336-
public static constructor_route_error(err: String): APIError {
337-
const ret: number = bindings.APIError_route_error(err);
326+
public static constructor_route_error(err: string): APIError {
327+
const ret: number = bindings.APIError_route_error(bindings.encodeString(err));
338328
const ret_hu_conv: APIError = APIError.constr_from_ptr(ret);
339329
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
340330
return ret_hu_conv;
341331
}
342332

343-
public static constructor_channel_unavailable(err: String): APIError {
344-
const ret: number = bindings.APIError_channel_unavailable(err);
333+
public static constructor_channel_unavailable(err: string): APIError {
334+
const ret: number = bindings.APIError_channel_unavailable(bindings.encodeString(err));
345335
const ret_hu_conv: APIError = APIError.constr_from_ptr(ret);
346336
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
347337
return ret_hu_conv;
@@ -363,51 +353,59 @@ export class APIError extends CommonBase {
363353

364354
}
365355
export class APIError_APIMisuseError extends APIError {
366-
public err: String;
356+
public err: string;
367357
/* @internal */
368-
public constructor(ptr: number, obj: bindings.LDKAPIError_APIMisuseError) {
358+
public constructor(ptr: number) {
369359
super(null, ptr);
370-
this.err = obj.err;
360+
const err: number = bindings.LDKAPIError_APIMisuseError_get_err(ptr);
361+
const err_conv: string = bindings.decodeString(err);
362+
this.err = err_conv;
371363
}
372364
}
373365
export class APIError_FeeRateTooHigh extends APIError {
374-
public err: String;
366+
public err: string;
375367
public feerate: number;
376368
/* @internal */
377-
public constructor(ptr: number, obj: bindings.LDKAPIError_FeeRateTooHigh) {
369+
public constructor(ptr: number) {
378370
super(null, ptr);
379-
this.err = obj.err;
380-
this.feerate = obj.feerate;
371+
const err: number = bindings.LDKAPIError_FeeRateTooHigh_get_err(ptr);
372+
const err_conv: string = bindings.decodeString(err);
373+
this.err = err_conv;
374+
this.feerate = bindings.LDKAPIError_FeeRateTooHigh_get_feerate(ptr);
381375
}
382376
}
383377
export class APIError_RouteError extends APIError {
384-
public err: String;
378+
public err: string;
385379
/* @internal */
386-
public constructor(ptr: number, obj: bindings.LDKAPIError_RouteError) {
380+
public constructor(ptr: number) {
387381
super(null, ptr);
388-
this.err = obj.err;
382+
const err: number = bindings.LDKAPIError_RouteError_get_err(ptr);
383+
const err_conv: string = bindings.decodeString(err);
384+
this.err = err_conv;
389385
}
390386
}
391387
export class APIError_ChannelUnavailable extends APIError {
392-
public err: String;
388+
public err: string;
393389
/* @internal */
394-
public constructor(ptr: number, obj: bindings.LDKAPIError_ChannelUnavailable) {
390+
public constructor(ptr: number) {
395391
super(null, ptr);
396-
this.err = obj.err;
392+
const err: number = bindings.LDKAPIError_ChannelUnavailable_get_err(ptr);
393+
const err_conv: string = bindings.decodeString(err);
394+
this.err = err_conv;
397395
}
398396
}
399397
export class APIError_MonitorUpdateFailed extends APIError {
400398
/* @internal */
401-
public constructor(ptr: number, obj: bindings.LDKAPIError_MonitorUpdateFailed) {
399+
public constructor(ptr: number) {
402400
super(null, ptr);
403401
}
404402
}
405403
export class APIError_IncompatibleShutdownScript extends APIError {
406404
public script: ShutdownScript;
407405
/* @internal */
408-
public constructor(ptr: number, obj: bindings.LDKAPIError_IncompatibleShutdownScript) {
406+
public constructor(ptr: number) {
409407
super(null, ptr);
410-
const script: number = obj.script;
408+
const script: number = bindings.LDKAPIError_IncompatibleShutdownScript_get_script(ptr);
411409
const script_hu_conv: ShutdownScript = new ShutdownScript(null, script);
412410
CommonBase.add_ref_from(script_hu_conv, this);
413411
this.script = script_hu_conv;

ts/structs/AcceptChannel.mts

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
279279

280280
import CommonBase from './CommonBase.mjs';
281281
import * as bindings from '../bindings.mjs'
282-
import * as InternalUtils from '../InternalUtils.mjs'
283282

284283

285284
export class AcceptChannel extends CommonBase {
@@ -289,47 +288,48 @@ export class AcceptChannel extends CommonBase {
289288
}
290289

291290
public get_temporary_channel_id(): Uint8Array {
292-
const ret: Uint8Array = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
293-
return ret;
291+
const ret: number = bindings.AcceptChannel_get_temporary_channel_id(this.ptr);
292+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
293+
return ret_conv;
294294
}
295295

296296
public set_temporary_channel_id(val: Uint8Array): void {
297-
bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
297+
bindings.AcceptChannel_set_temporary_channel_id(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 32)));
298298
}
299299

300-
public get_dust_limit_satoshis(): number {
301-
const ret: number = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
300+
public get_dust_limit_satoshis(): bigint {
301+
const ret: bigint = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr);
302302
return ret;
303303
}
304304

305-
public set_dust_limit_satoshis(val: number): void {
305+
public set_dust_limit_satoshis(val: bigint): void {
306306
bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val);
307307
}
308308

309-
public get_max_htlc_value_in_flight_msat(): number {
310-
const ret: number = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
309+
public get_max_htlc_value_in_flight_msat(): bigint {
310+
const ret: bigint = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr);
311311
return ret;
312312
}
313313

314-
public set_max_htlc_value_in_flight_msat(val: number): void {
314+
public set_max_htlc_value_in_flight_msat(val: bigint): void {
315315
bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
316316
}
317317

318-
public get_channel_reserve_satoshis(): number {
319-
const ret: number = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
318+
public get_channel_reserve_satoshis(): bigint {
319+
const ret: bigint = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr);
320320
return ret;
321321
}
322322

323-
public set_channel_reserve_satoshis(val: number): void {
323+
public set_channel_reserve_satoshis(val: bigint): void {
324324
bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val);
325325
}
326326

327-
public get_htlc_minimum_msat(): number {
328-
const ret: number = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
327+
public get_htlc_minimum_msat(): bigint {
328+
const ret: bigint = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr);
329329
return ret;
330330
}
331331

332-
public set_htlc_minimum_msat(val: number): void {
332+
public set_htlc_minimum_msat(val: bigint): void {
333333
bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val);
334334
}
335335

@@ -361,57 +361,63 @@ export class AcceptChannel extends CommonBase {
361361
}
362362

363363
public get_funding_pubkey(): Uint8Array {
364-
const ret: Uint8Array = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
365-
return ret;
364+
const ret: number = bindings.AcceptChannel_get_funding_pubkey(this.ptr);
365+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
366+
return ret_conv;
366367
}
367368

368369
public set_funding_pubkey(val: Uint8Array): void {
369-
bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
370+
bindings.AcceptChannel_set_funding_pubkey(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
370371
}
371372

372373
public get_revocation_basepoint(): Uint8Array {
373-
const ret: Uint8Array = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
374-
return ret;
374+
const ret: number = bindings.AcceptChannel_get_revocation_basepoint(this.ptr);
375+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
376+
return ret_conv;
375377
}
376378

377379
public set_revocation_basepoint(val: Uint8Array): void {
378-
bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
380+
bindings.AcceptChannel_set_revocation_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
379381
}
380382

381383
public get_payment_point(): Uint8Array {
382-
const ret: Uint8Array = bindings.AcceptChannel_get_payment_point(this.ptr);
383-
return ret;
384+
const ret: number = bindings.AcceptChannel_get_payment_point(this.ptr);
385+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
386+
return ret_conv;
384387
}
385388

386389
public set_payment_point(val: Uint8Array): void {
387-
bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
390+
bindings.AcceptChannel_set_payment_point(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
388391
}
389392

390393
public get_delayed_payment_basepoint(): Uint8Array {
391-
const ret: Uint8Array = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
392-
return ret;
394+
const ret: number = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr);
395+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
396+
return ret_conv;
393397
}
394398

395399
public set_delayed_payment_basepoint(val: Uint8Array): void {
396-
bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
400+
bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
397401
}
398402

399403
public get_htlc_basepoint(): Uint8Array {
400-
const ret: Uint8Array = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
401-
return ret;
404+
const ret: number = bindings.AcceptChannel_get_htlc_basepoint(this.ptr);
405+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
406+
return ret_conv;
402407
}
403408

404409
public set_htlc_basepoint(val: Uint8Array): void {
405-
bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
410+
bindings.AcceptChannel_set_htlc_basepoint(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
406411
}
407412

408413
public get_first_per_commitment_point(): Uint8Array {
409-
const ret: Uint8Array = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
410-
return ret;
414+
const ret: number = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr);
415+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
416+
return ret_conv;
411417
}
412418

413419
public set_first_per_commitment_point(val: Uint8Array): void {
414-
bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
420+
bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 33)));
415421
}
416422

417423
public clone_ptr(): number {
@@ -427,12 +433,13 @@ export class AcceptChannel extends CommonBase {
427433
}
428434

429435
public write(): Uint8Array {
430-
const ret: Uint8Array = bindings.AcceptChannel_write(this.ptr);
431-
return ret;
436+
const ret: number = bindings.AcceptChannel_write(this.ptr);
437+
const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);
438+
return ret_conv;
432439
}
433440

434441
public static constructor_read(ser: Uint8Array): Result_AcceptChannelDecodeErrorZ {
435-
const ret: number = bindings.AcceptChannel_read(ser);
442+
const ret: number = bindings.AcceptChannel_read(bindings.encodeUint8Array(ser));
436443
const ret_hu_conv: Result_AcceptChannelDecodeErrorZ = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret);
437444
return ret_hu_conv;
438445
}

ts/structs/Access.mts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,11 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
280280

281281
import CommonBase from './CommonBase.mjs';
282282
import * as bindings from '../bindings.mjs'
283-
import * as InternalUtils from '../InternalUtils.mjs'
284283

285284

286285

287286
export interface AccessInterface {
288-
get_utxo(genesis_hash: Uint8Array, short_channel_id: number): Result_TxOutAccessErrorZ;
287+
get_utxo(genesis_hash: Uint8Array, short_channel_id: bigint): Result_TxOutAccessErrorZ;
289288
}
290289

291290
class LDKAccessHolder {
@@ -305,8 +304,9 @@ export class Access extends CommonBase {
305304
static new_impl(arg: AccessInterface): Access {
306305
const impl_holder: LDKAccessHolder = new LDKAccessHolder();
307306
let structImplementation = {
308-
get_utxo (genesis_hash: Uint8Array, short_channel_id: number): number {
309-
const ret: Result_TxOutAccessErrorZ = arg.get_utxo(genesis_hash, short_channel_id);
307+
get_utxo (genesis_hash: number, short_channel_id: bigint): number {
308+
const genesis_hash_conv: Uint8Array = bindings.decodeUint8Array(genesis_hash);
309+
const ret: Result_TxOutAccessErrorZ = arg.get_utxo(genesis_hash_conv, short_channel_id);
310310
const result: number = ret == null ? 0 : ret.clone_ptr();
311311
return result;
312312
},
@@ -317,8 +317,8 @@ export class Access extends CommonBase {
317317
impl_holder.held.bindings_instance = structImplementation;
318318
return impl_holder.held;
319319
}
320-
public get_utxo(genesis_hash: Uint8Array, short_channel_id: number): Result_TxOutAccessErrorZ {
321-
const ret: number = bindings.Access_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id);
320+
public get_utxo(genesis_hash: Uint8Array, short_channel_id: bigint): Result_TxOutAccessErrorZ {
321+
const ret: number = bindings.Access_get_utxo(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(genesis_hash, 32)), short_channel_id);
322322
const ret_hu_conv: Result_TxOutAccessErrorZ = Result_TxOutAccessErrorZ.constr_from_ptr(ret);
323323
return ret_hu_conv;
324324
}

0 commit comments

Comments
 (0)