Skip to content

Commit d8186cb

Browse files
authored
feat: upgrade to KTH-MONO v0.70.0 and migrate from C-API (#15)
- Migrate dependency from standalone C-API to KTH-MONO monorepo - Update Conan package reference to use KTH-MONO v0.70.0 - C-API is now part of the KTH-MONO monorepo structure - Update build configuration and type definitions accordingly
1 parent 3a73ca3 commit d8186cb

File tree

7 files changed

+24
-27
lines changed

7 files changed

+24
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@knuth/js-wasm",
3-
"version": "2.6.0",
3+
"version": "2.7.0",
44
"publishConfig": {
55
"access": "public"
66
},

src/kth.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/kth.wasm

11.1 KB
Binary file not shown.

tests/Kth.test.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,32 @@ describe('Kth', () => {
2525

2626
const cppapiBuildTimestamp = new Date(config.cppapiBuildTimestamp);
2727
expect(cppapiBuildTimestamp.getFullYear()).toEqual(2025);
28-
expect(cppapiBuildTimestamp.getMonth()).toEqual(3); // January is 0
29-
expect(cppapiBuildTimestamp.getDate()).toEqual(16);
28+
expect(cppapiBuildTimestamp.getMonth()).toEqual(6); // January is 0
29+
expect(cppapiBuildTimestamp.getDate()).toEqual(31);
3030

3131
const capiBuildTimestamp = new Date(config.capiBuildTimestamp);
3232
expect(capiBuildTimestamp.getFullYear()).toEqual(2025);
33-
expect(capiBuildTimestamp.getMonth()).toEqual(3); // January is 0
34-
expect(capiBuildTimestamp.getDate()).toEqual(16);
33+
expect(capiBuildTimestamp.getMonth()).toEqual(6); // January is 0
34+
expect(capiBuildTimestamp.getDate()).toEqual(31);
3535

3636
expect(config.capiBuildGitHash).toEqual('');
3737

3838
const wasmBuildTimestamp = new Date(config.wasmBuildTimestamp);
3939
expect(wasmBuildTimestamp.getFullYear()).toEqual(2025);
40-
expect(wasmBuildTimestamp.getMonth()).toEqual(3); // January is 0
41-
expect(wasmBuildTimestamp.getDate()).toEqual(21);
40+
expect(wasmBuildTimestamp.getMonth()).toEqual(7); // January is 0
41+
expect(wasmBuildTimestamp.getDate()).toEqual(1);
4242

4343
// Type Sizes
4444
expect(config.typeSizesInt).toEqual(4);
4545
expect(config.typeSizesLong).toEqual(4);
4646
expect(config.typeSizesPointer).toEqual(4);
4747

4848
// Library and Version Information
49-
expect(config.cppapiVersion).toEqual('0.53.0');
50-
expect(config.capiVersion).toEqual('0.62.0'); // C-API version
51-
expect(config.wasmLibraryVersion).toEqual('2.5.0');
49+
expect(config.cppapiVersion).toEqual('0.70.0');
50+
expect(config.capiVersion).toEqual('0.70.0'); // C-API version
51+
expect(config.wasmLibraryVersion).toEqual('2.6.0');
5252
expect(config.logLibrary).toEqual('spdlog');
53-
expect(config.useLibmdbx).toEqual(false);
54-
53+
5554
// Specific Platform Information
5655
expect(config.microarchitectureId).toEqual('');
5756
expect(config.marchNames).toEqual('');

tests/Script.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ const SCRIPT_17_OF_17_MULTISIG =
6969
"[02440e0304bf8d32b2012994393c6a477acf238dd6adb4c3cef5bfa72f30c9861c] " +
7070
"16 checkmultisig";
7171

72-
function createScript(hex: string): Script | undefined {
72+
function createScript(hex: string, prefix: boolean = true): Script | undefined {
7373
const bytes = hexStrToBytes(hex);
74-
return Script.fromData(bytes, true);
74+
return Script.fromData(bytes, prefix);
7575
}
7676

7777
function newTx(test: ScriptTest) : Transaction | undefined {
@@ -278,7 +278,7 @@ describe('Script', () => {
278278
//const inputScript = createScript('47304402205e97e8ba27f9b1fe80385e34def3cbf13a197d3b69320b3118ac8fc64a621caa022019c6c258c407fa9df7381f038125c1bf37c0ebc83d7a923ecbc013b91bc5de9f412103f7f62ae6abf20a8c1d8e281d2d1b0187bcd23ae9bb241bfb752f3b76c4cf3432');
279279
const inputScript = tx.inputs[0].script; // 47304402205e97e8ba27f9b1fe80385e34def3cbf13a197d3b69320b3118ac8fc64a621caa022019c6c258c407fa9df7381f038125c1bf37c0ebc83d7a923ecbc013b91bc5de9f412103f7f62ae6abf20a8c1d8e281d2d1b0187bcd23ae9bb241bfb752f3b76c4cf3432
280280
// From transaction: 606aea9ac9c457b70e9afed7fbf470a995d243baa296723803db3b5b1db81d51 : 2
281-
const prevoutScript = createScript('76a91481ee9b2293430e4c1c90d9061f245407f8548e1388ac');
281+
const prevoutScript = createScript('76a91481ee9b2293430e4c1c90d9061f245407f8548e1388ac', true);
282282

283283
if ( ! tx || ! inputScript || ! prevoutScript ) {
284284
return;

types/Kth.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export declare class Kth {
1717
capiVersion: string;
1818
wasmLibraryVersion: string;
1919
logLibrary: "boost" | "spdlog" | "binlog";
20-
useLibmdbx: boolean;
2120
microarchitectureId: string;
2221
marchNames: string;
2322
currency: "bitcoin" | "bitcoin_cash" | "litecoin";

types/wasm/glue.d.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export declare class LibConfig {
1717
private readonly [ptrSym];
1818
static _create(ptr: number): LibConfig;
1919
get log_library(): LogLibrary;
20-
get use_libmdbx(): boolean;
2120
get version(): string;
2221
get microarchitecture_id(): string;
2322
get currency(): Currency;
@@ -198,6 +197,15 @@ export declare class HdPrivateNative {
198197
derivePrivate(index: number): HdPrivateNative;
199198
derivePublic(index: number): HdPublicNative;
200199
}
200+
export declare class PaymentAddressListNative {
201+
private readonly [ptrSym];
202+
static _create(ptr: number): PaymentAddressListNative;
203+
protected _destructor(): void;
204+
constructor();
205+
pushBack(utxo: PaymentAddressNative): void;
206+
count(): number;
207+
nth(index: number): PaymentAddressNative;
208+
}
201209
export declare class PaymentAddressNative {
202210
private readonly [ptrSym];
203211
static _create(ptr: number): PaymentAddressNative;
@@ -217,15 +225,6 @@ export declare class PaymentAddressNative {
217225
static extractInput(script: ScriptNative, p2khVersion: number, p2shVersion: number): PaymentAddressListNative;
218226
static extractOutput(script: ScriptNative, p2khVersion: number, p2shVersion: number): PaymentAddressListNative;
219227
}
220-
export declare class PaymentAddressListNative {
221-
private readonly [ptrSym];
222-
static _create(ptr: number): PaymentAddressListNative;
223-
protected _destructor(): void;
224-
constructor();
225-
pushBack(utxo: PaymentAddressNative): void;
226-
count(): number;
227-
nth(index: number): PaymentAddressNative;
228-
}
229228
export declare class EcPrivateNative {
230229
private readonly [ptrSym];
231230
static _create(ptr: number): EcPrivateNative;

0 commit comments

Comments
 (0)