Skip to content

Commit bf08029

Browse files
committed
Update auto-generated TypeScript files
1 parent ca0aed5 commit bf08029

File tree

277 files changed

+97232
-60
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

+97232
-60
lines changed

ts/InternalUtils.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export function check_arr_len(arr: Uint8Array, len: number): Uint8Array {
2+
if (arr.length != len) { throw new Error("Expected array of length " + len + "got " + arr.length); }
3+
return arr;
4+
}

ts/bindings.mts

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11

2-
function freer(f: () => void) { f() }
3-
const finalizer = new FinalizationRegistry(freer);
4-
const memory = new WebAssembly.Memory({initial: 256});
5-
62
const imports: any = {};
73
imports.env = {};
84

9-
imports.env.memoryBase = 0;
10-
imports.env.memory = memory;
115
imports.env.tableBase = 0;
126
imports.env.table = new WebAssembly.Table({initial: 4, element: 'anyfunc'});
137

@@ -60,24 +54,24 @@ const nextMultipleOfFour = (value: number) => {
6054

6155
const encodeUint8Array = (inputArray) => {
6256
const cArrayPointer = wasm.TS_malloc(inputArray.length + 4);
63-
const arrayLengthView = new Uint32Array(memory.buffer, cArrayPointer, 1);
57+
const arrayLengthView = new Uint32Array(wasm.memory.buffer, cArrayPointer, 1);
6458
arrayLengthView[0] = inputArray.length;
65-
const arrayMemoryView = new Uint8Array(memory.buffer, cArrayPointer + 4, inputArray.length);
59+
const arrayMemoryView = new Uint8Array(wasm.memory.buffer, cArrayPointer + 4, inputArray.length);
6660
arrayMemoryView.set(inputArray);
6761
return cArrayPointer;
6862
}
6963

7064
const encodeUint32Array = (inputArray) => {
7165
const cArrayPointer = wasm.TS_malloc((inputArray.length + 1) * 4);
72-
const arrayMemoryView = new Uint32Array(memory.buffer, cArrayPointer, inputArray.length);
66+
const arrayMemoryView = new Uint32Array(wasm.memory.buffer, cArrayPointer, inputArray.length);
7367
arrayMemoryView.set(inputArray, 1);
7468
arrayMemoryView[0] = inputArray.length;
7569
return cArrayPointer;
7670
}
7771

7872
const getArrayLength = (arrayPointer) => {
7973
const arraySizeViewer = new Uint32Array(
80-
memory.buffer, // value
74+
wasm.memory.buffer, // value
8175
arrayPointer, // offset
8276
1 // one int
8377
);
@@ -86,7 +80,7 @@ const getArrayLength = (arrayPointer) => {
8680
const decodeUint8Array = (arrayPointer, free = true) => {
8781
const arraySize = getArrayLength(arrayPointer);
8882
const actualArrayViewer = new Uint8Array(
89-
memory.buffer, // value
83+
wasm.memory.buffer, // value
9084
arrayPointer + 4, // offset (ignoring length bytes)
9185
arraySize // uint8 count
9286
);
@@ -101,7 +95,7 @@ const decodeUint8Array = (arrayPointer, free = true) => {
10195
const decodeUint32Array = (arrayPointer, free = true) => {
10296
const arraySize = getArrayLength(arrayPointer);
10397
const actualArrayViewer = new Uint32Array(
104-
memory.buffer, // value
98+
wasm.memory.buffer, // value
10599
arrayPointer + 4, // offset (ignoring length bytes)
106100
arraySize // uint32 count
107101
);
@@ -119,7 +113,7 @@ const encodeString = (string) => {
119113
const memoryNeed = nextMultipleOfFour(string.length + 1);
120114
const stringPointer = wasm.TS_malloc(memoryNeed);
121115
const stringMemoryView = new Uint8Array(
122-
memory.buffer, // value
116+
wasm.memory.buffer, // value
123117
stringPointer, // offset
124118
string.length + 1 // length
125119
);
@@ -131,7 +125,7 @@ const encodeString = (string) => {
131125
}
132126

133127
const decodeString = (stringPointer, free = true) => {
134-
const memoryView = new Uint8Array(memory.buffer, stringPointer);
128+
const memoryView = new Uint8Array(wasm.memory.buffer, stringPointer);
135129
let cursor = 0;
136130
let result = '';
137131

@@ -710,8 +704,8 @@ LDKSecp256k1Error_NotEnoughMemory,
710704
}
711705

712706
export function LDKType_new(impl: LDKType): number {
713-
throw new Error('unimplemented'); // TODO: bind to WASM
714-
}
707+
throw new Error('unimplemented'); // TODO: bind to WASM
708+
}
715709

716710
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
717711

@@ -1241,8 +1235,8 @@ LDKSecp256k1Error_NotEnoughMemory,
12411235
}
12421236

12431237
export function LDKBaseSign_new(impl: LDKBaseSign, pubkeys: number): number {
1244-
throw new Error('unimplemented'); // TODO: bind to WASM
1245-
}
1238+
throw new Error('unimplemented'); // TODO: bind to WASM
1239+
}
12461240

12471241
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
12481242

@@ -1369,8 +1363,8 @@ LDKSecp256k1Error_NotEnoughMemory,
13691363
}
13701364

13711365
export function LDKSign_new(impl: LDKSign, BaseSign: LDKBaseSign, pubkeys: number): number {
1372-
throw new Error('unimplemented'); // TODO: bind to WASM
1373-
}
1366+
throw new Error('unimplemented'); // TODO: bind to WASM
1367+
}
13741368

13751369
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
13761370

@@ -1893,8 +1887,8 @@ LDKSecp256k1Error_NotEnoughMemory,
18931887
}
18941888

18951889
export function LDKAccess_new(impl: LDKAccess): number {
1896-
throw new Error('unimplemented'); // TODO: bind to WASM
1897-
}
1890+
throw new Error('unimplemented'); // TODO: bind to WASM
1891+
}
18981892

18991893
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
19001894

@@ -2820,8 +2814,8 @@ LDKSecp256k1Error_NotEnoughMemory,
28202814
}
28212815

28222816
export function LDKFilter_new(impl: LDKFilter): number {
2823-
throw new Error('unimplemented'); // TODO: bind to WASM
2824-
}
2817+
throw new Error('unimplemented'); // TODO: bind to WASM
2818+
}
28252819

28262820
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
28272821

@@ -3144,8 +3138,8 @@ LDKSecp256k1Error_NotEnoughMemory,
31443138
}
31453139

31463140
export function LDKWatch_new(impl: LDKWatch): number {
3147-
throw new Error('unimplemented'); // TODO: bind to WASM
3148-
}
3141+
throw new Error('unimplemented'); // TODO: bind to WASM
3142+
}
31493143

31503144
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
31513145

@@ -3184,8 +3178,8 @@ LDKSecp256k1Error_NotEnoughMemory,
31843178
}
31853179

31863180
export function LDKBroadcasterInterface_new(impl: LDKBroadcasterInterface): number {
3187-
throw new Error('unimplemented'); // TODO: bind to WASM
3188-
}
3181+
throw new Error('unimplemented'); // TODO: bind to WASM
3182+
}
31893183

31903184
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
31913185

@@ -3215,8 +3209,8 @@ LDKSecp256k1Error_NotEnoughMemory,
32153209
}
32163210

32173211
export function LDKKeysInterface_new(impl: LDKKeysInterface): number {
3218-
throw new Error('unimplemented'); // TODO: bind to WASM
3219-
}
3212+
throw new Error('unimplemented'); // TODO: bind to WASM
3213+
}
32203214

32213215
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
32223216

@@ -3295,8 +3289,8 @@ LDKSecp256k1Error_NotEnoughMemory,
32953289
}
32963290

32973291
export function LDKFeeEstimator_new(impl: LDKFeeEstimator): number {
3298-
throw new Error('unimplemented'); // TODO: bind to WASM
3299-
}
3292+
throw new Error('unimplemented'); // TODO: bind to WASM
3293+
}
33003294

33013295
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
33023296

@@ -3319,8 +3313,8 @@ LDKSecp256k1Error_NotEnoughMemory,
33193313
}
33203314

33213315
export function LDKLogger_new(impl: LDKLogger): number {
3322-
throw new Error('unimplemented'); // TODO: bind to WASM
3323-
}
3316+
throw new Error('unimplemented'); // TODO: bind to WASM
3317+
}
33243318

33253319
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
33263320

@@ -3367,8 +3361,8 @@ LDKSecp256k1Error_NotEnoughMemory,
33673361
}
33683362

33693363
export function LDKMessageSendEventsProvider_new(impl: LDKMessageSendEventsProvider): number {
3370-
throw new Error('unimplemented'); // TODO: bind to WASM
3371-
}
3364+
throw new Error('unimplemented'); // TODO: bind to WASM
3365+
}
33723366

33733367
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
33743368

@@ -3391,8 +3385,8 @@ LDKSecp256k1Error_NotEnoughMemory,
33913385
}
33923386

33933387
export function LDKEventHandler_new(impl: LDKEventHandler): number {
3394-
throw new Error('unimplemented'); // TODO: bind to WASM
3395-
}
3388+
throw new Error('unimplemented'); // TODO: bind to WASM
3389+
}
33963390

33973391
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
33983392

@@ -3415,8 +3409,8 @@ LDKSecp256k1Error_NotEnoughMemory,
34153409
}
34163410

34173411
export function LDKEventsProvider_new(impl: LDKEventsProvider): number {
3418-
throw new Error('unimplemented'); // TODO: bind to WASM
3419-
}
3412+
throw new Error('unimplemented'); // TODO: bind to WASM
3413+
}
34203414

34213415
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
34223416

@@ -3440,8 +3434,8 @@ LDKSecp256k1Error_NotEnoughMemory,
34403434
}
34413435

34423436
export function LDKListen_new(impl: LDKListen): number {
3443-
throw new Error('unimplemented'); // TODO: bind to WASM
3444-
}
3437+
throw new Error('unimplemented'); // TODO: bind to WASM
3438+
}
34453439

34463440
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
34473441

@@ -3475,8 +3469,8 @@ LDKSecp256k1Error_NotEnoughMemory,
34753469
}
34763470

34773471
export function LDKConfirm_new(impl: LDKConfirm): number {
3478-
throw new Error('unimplemented'); // TODO: bind to WASM
3479-
}
3472+
throw new Error('unimplemented'); // TODO: bind to WASM
3473+
}
34803474

34813475
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
34823476

@@ -3524,8 +3518,8 @@ LDKSecp256k1Error_NotEnoughMemory,
35243518
}
35253519

35263520
export function LDKPersist_new(impl: LDKPersist): number {
3527-
throw new Error('unimplemented'); // TODO: bind to WASM
3528-
}
3521+
throw new Error('unimplemented'); // TODO: bind to WASM
3522+
}
35293523

35303524
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
35313525

@@ -3575,8 +3569,8 @@ LDKSecp256k1Error_NotEnoughMemory,
35753569
}
35763570

35773571
export function LDKChannelMessageHandler_new(impl: LDKChannelMessageHandler, MessageSendEventsProvider: LDKMessageSendEventsProvider): number {
3578-
throw new Error('unimplemented'); // TODO: bind to WASM
3579-
}
3572+
throw new Error('unimplemented'); // TODO: bind to WASM
3573+
}
35803574

35813575
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
35823576

@@ -3760,8 +3754,8 @@ LDKSecp256k1Error_NotEnoughMemory,
37603754
}
37613755

37623756
export function LDKRoutingMessageHandler_new(impl: LDKRoutingMessageHandler, MessageSendEventsProvider: LDKMessageSendEventsProvider): number {
3763-
throw new Error('unimplemented'); // TODO: bind to WASM
3764-
}
3757+
throw new Error('unimplemented'); // TODO: bind to WASM
3758+
}
37653759

37663760
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
37673761

@@ -3856,8 +3850,8 @@ LDKSecp256k1Error_NotEnoughMemory,
38563850
}
38573851

38583852
export function LDKCustomMessageReader_new(impl: LDKCustomMessageReader): number {
3859-
throw new Error('unimplemented'); // TODO: bind to WASM
3860-
}
3853+
throw new Error('unimplemented'); // TODO: bind to WASM
3854+
}
38613855

38623856
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
38633857

@@ -3881,8 +3875,8 @@ LDKSecp256k1Error_NotEnoughMemory,
38813875
}
38823876

38833877
export function LDKCustomMessageHandler_new(impl: LDKCustomMessageHandler, CustomMessageReader: LDKCustomMessageReader): number {
3884-
throw new Error('unimplemented'); // TODO: bind to WASM
3885-
}
3878+
throw new Error('unimplemented'); // TODO: bind to WASM
3879+
}
38863880

38873881
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
38883882

@@ -3916,8 +3910,8 @@ LDKSecp256k1Error_NotEnoughMemory,
39163910
}
39173911

39183912
export function LDKSocketDescriptor_new(impl: LDKSocketDescriptor): number {
3919-
throw new Error('unimplemented'); // TODO: bind to WASM
3920-
}
3913+
throw new Error('unimplemented'); // TODO: bind to WASM
3914+
}
39213915

39223916
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
39233917

@@ -3959,8 +3953,8 @@ LDKSecp256k1Error_NotEnoughMemory,
39593953
}
39603954

39613955
export function LDKScore_new(impl: LDKScore): number {
3962-
throw new Error('unimplemented'); // TODO: bind to WASM
3963-
}
3956+
throw new Error('unimplemented'); // TODO: bind to WASM
3957+
}
39643958

39653959
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
39663960

@@ -4007,8 +4001,8 @@ LDKSecp256k1Error_NotEnoughMemory,
40074001
}
40084002

40094003
export function LDKLockableScore_new(impl: LDKLockableScore): number {
4010-
throw new Error('unimplemented'); // TODO: bind to WASM
4011-
}
4004+
throw new Error('unimplemented'); // TODO: bind to WASM
4005+
}
40124006

40134007
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
40144008

0 commit comments

Comments
 (0)