Update auto-generated TypeScript Bindings
[ldk-java] / typescript_strings.py
index e3b980830f6d0bce2172be184ef7d248d1abd351..462a77fe951a135ab20a8727b5a0b2ebb9d19938 100644 (file)
@@ -20,7 +20,7 @@ class Consts:
             uint8_t = ['number', 'number', 'Uint8Array'],
             uint16_t = ['number', 'number', 'Uint16Array'],
             uint32_t = ['number', 'number', 'Uint32Array'],
-            uint64_t = ['BigInt', 'BigInt', 'BigUint64Array'],
+            uint64_t = ['bigint', 'bigint', 'BigUint64Array'],
         )
         self.java_type_map = dict(
             String = "number"
@@ -78,7 +78,7 @@ export default class CommonBase {
        /** The script_pubkey in this output */
        public script_pubkey: Uint8Array;
        /** The value, in satoshis, of this output */
-       public value: BigInt;
+       public value: bigint;
 
        /* @internal */
        public constructor(_dummy: object, ptr: number) {
@@ -86,7 +86,7 @@ export default class CommonBase {
                this.script_pubkey = bindings.decodeUint8Array(bindings.TxOut_get_script_pubkey(ptr));
                this.value = bindings.TxOut_get_value(ptr);
        }
-       public constructor_new(value: BigInt, script_pubkey: Uint8Array): TxOut {
+       public constructor_new(value: bigint, script_pubkey: Uint8Array): TxOut {
                return new TxOut(null, bindings.TxOut_new(bindings.encodeUint8Array(script_pubkey), value));
        }
 }"""
@@ -290,7 +290,6 @@ void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
         self.hu_struct_file_prefix = """
 import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
 
 """
         self.util_fn_pfx = self.hu_struct_file_prefix + "\nexport class UtilMethods extends CommonBase {\n"
@@ -304,12 +303,6 @@ import * as InternalUtils from '../InternalUtils.mjs'
         self.is_arr_some_check = ("", " != 0")
         self.get_native_arr_len_call = ("", "->arr_len")
 
-        with open(outdir + "/InternalUtils.mts", "w") as f:
-            f.write("export function check_arr_len(arr: Uint8Array, len: number): Uint8Array {\n")
-            f.write("\tif (arr.length != len) { throw new Error(\"Expected array of length \" + len + \"got \" + arr.length); }\n")
-            f.write("\treturn arr;\n")
-            f.write("}")
-
     def release_native_arr_ptr_call(self, ty_info, arr_var, arr_ptr_var):
         return None
     def create_native_arr_call(self, arr_len, ty_info):
@@ -466,7 +459,7 @@ export function encodeUint32Array (inputArray: Uint32Array|Array<number>): numbe
        arrayMemoryView[0] = inputArray.length;
        return cArrayPointer;
 }
-export function encodeUint64Array (inputArray: BigUint64Array|Array<BigInt>): number {
+export function encodeUint64Array (inputArray: BigUint64Array|Array<bigint>): number {
        const cArrayPointer = wasm.TS_malloc(inputArray.length * 8 + 1);
        const arrayLengthView = new Uint32Array(wasm.memory.buffer, cArrayPointer, 1);
        arrayLengthView[0] = inputArray.length;