diff --git a/index.ts b/index.ts index 2f0713e..bec300d 100644 --- a/index.ts +++ b/index.ts @@ -1113,8 +1113,11 @@ function route(): void { async function getClaimAddress(): Promise { const wollet = getWollet(); - syncWallet(wollet); - const claimAddress = wollet.address(null).address(); + const client = getEsploraClient(); + const lastUsedIndex = await client.lastUsedIndex(wollet.descriptor()); + console.log('Last used indexes:', lastUsedIndex.external, lastUsedIndex.internal); + const indexToUse = lastUsedIndex.external != null ? lastUsedIndex.external + 1 : 0; + const claimAddress = wollet.address(indexToUse).address(); return claimAddress; } diff --git a/package-lock.json b/package-lock.json index f523398..c425c70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "lwk_wasm": "^0.13.1" + "lwk_wasm": "file:/home/casatta/git/lwk/lwk_wasm/pkg" }, "devDependencies": { "@eslint/js": "^9.36.0", @@ -21,6 +21,14 @@ "webpack-dev-server": "^4.15.1" } }, + "../../../casat/code/lwk_wasm/pkg": { + "extraneous": true + }, + "../lwk/lwk_wasm/pkg": { + "name": "lwk_wasm", + "version": "0.13.1", + "license": "MIT OR BSD-2-Clause" + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -3401,10 +3409,8 @@ "license": "MIT" }, "node_modules/lwk_wasm": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/lwk_wasm/-/lwk_wasm-0.13.1.tgz", - "integrity": "sha512-H1JDqjo5dMY1pTh70v9De83C+NT+9rLeZSCJoclZuJ+sf6om0kNGa13/pP/g0S1JsHhiqMRwu9iEOiHYtF4Ffw==", - "license": "MIT OR BSD-2-Clause" + "resolved": "../lwk/lwk_wasm/pkg", + "link": true }, "node_modules/math-intrinsics": { "version": "1.1.0", diff --git a/package.json b/package.json index d420b9c..8f6e983 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "deploy": "npm run build && npm run sync" }, "dependencies": { - "lwk_wasm": "^0.13.1" + "lwk_wasm": "file:/home/casatta/git/lwk/lwk_wasm/pkg" }, "devDependencies": { "@eslint/js": "^9.36.0",