@gvnrdao/dh-lit-actions 0.0.309 → 0.0.310
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a_dev_address-probe-signer.meta.json +1 -1
- package/dist/a_dev_address-probe.meta.json +1 -1
- package/dist/a_dev_always-signer.meta.json +1 -1
- package/dist/a_dev_authorization-dummy-b.meta.json +1 -1
- package/dist/a_dev_authorization-dummy.meta.json +1 -1
- package/dist/a_dev_ethers-version-probe.meta.json +1 -1
- package/dist/a_dev_process-payment-sign-only.meta.json +1 -1
- package/dist/btc-address-balance.action.js +1 -1
- package/dist/btc-address-balance.hash +1 -1
- package/dist/btc-address-balance.meta.json +5 -5
- package/dist/btc-transaction-signer.action.js +1 -1
- package/dist/btc-transaction-signer.hash +1 -1
- package/dist/btc-transaction-signer.meta.json +5 -5
- package/dist/btc-utxo-invalidator.action.js +1 -1
- package/dist/btc-utxo-invalidator.hash +1 -1
- package/dist/btc-utxo-invalidator.meta.json +5 -5
- package/dist/btc-withdrawal.action.js +1 -1
- package/dist/btc-withdrawal.hash +1 -1
- package/dist/btc-withdrawal.meta.json +5 -5
- package/dist/encrypt-parameter.meta.json +1 -1
- package/dist/extend-position-validator.action.js +1 -1
- package/dist/extend-position-validator.hash +1 -1
- package/dist/extend-position-validator.meta.json +5 -5
- package/dist/liquidation-validator.action.js +1 -1
- package/dist/liquidation-validator.hash +1 -1
- package/dist/liquidation-validator.meta.json +5 -5
- package/dist/loan-vault-btc-balance.action.js +1 -1
- package/dist/loan-vault-btc-balance.hash +1 -1
- package/dist/loan-vault-btc-balance.meta.json +5 -5
- package/dist/pkp-validator.meta.json +1 -1
- package/dist/price-oracle.meta.json +1 -1
- package/dist/process-payment-validator.action.js +1 -1
- package/dist/process-payment-validator.hash +1 -1
- package/dist/process-payment-validator.meta.json +5 -5
- package/dist/stale-spend-recovery-validator.action.js +1 -1
- package/dist/stale-spend-recovery-validator.hash +1 -1
- package/dist/stale-spend-recovery-validator.meta.json +5 -5
- package/dist/ucd-mint-validator.action.js +1 -1
- package/dist/ucd-mint-validator.hash +1 -1
- package/dist/ucd-mint-validator.meta.json +5 -5
- package/package.json +1 -1
- package/pkg-dist/pkg-src/index.js +138 -65
- package/pkg-dist/pkg-src/index.js.map +4 -4
- package/pkg-dist/src/constants/chunks/bitcoin-network-config.d.ts +7 -0
- package/pkg-dist/src/constants/chunks/bitcoin-network-config.d.ts.map +1 -1
- package/pkg-dist/src/interfaces/chunks/vault-balance.i.d.ts +5 -0
- package/pkg-dist/src/interfaces/chunks/vault-balance.i.d.ts.map +1 -1
- package/pkg-dist/src/modules/bitcoin-balance-consensus.module.d.ts +23 -2
- package/pkg-dist/src/modules/bitcoin-balance-consensus.module.d.ts.map +1 -1
- package/pkg-dist/src/modules/bitcoin-data-provider.module.d.ts +8 -1
- package/pkg-dist/src/modules/bitcoin-data-provider.module.d.ts.map +1 -1
- package/pkg-dist/src/modules/bitcoin-provider-auth.d.ts +70 -0
- package/pkg-dist/src/modules/bitcoin-provider-auth.d.ts.map +1 -0
- package/pkg-dist/src/modules/bitcoin-provider-registry.d.ts.map +1 -1
|
@@ -675,103 +675,103 @@ var DH_LIT_ACTIONS_CHIPOTLE = {
|
|
|
675
675
|
}
|
|
676
676
|
},
|
|
677
677
|
btcTransactionSigner: {
|
|
678
|
-
cid: "
|
|
678
|
+
cid: "QmZs56sVTCJv7mgvyRYfpYHFvFLcSeXa4H44qUYT7z14QP",
|
|
679
679
|
authorizedCidHex: cidToHex(
|
|
680
|
-
"
|
|
680
|
+
"QmZs56sVTCJv7mgvyRYfpYHFvFLcSeXa4H44qUYT7z14QP"
|
|
681
681
|
),
|
|
682
682
|
name: "Btc Transaction Signer",
|
|
683
683
|
description: "Production Btc Transaction Signer",
|
|
684
684
|
version: "1.0.0",
|
|
685
685
|
deployed: true,
|
|
686
|
-
deployedAt:
|
|
687
|
-
size:
|
|
688
|
-
hash: "
|
|
686
|
+
deployedAt: 1781542204806,
|
|
687
|
+
size: 42376,
|
|
688
|
+
hash: "f4aed3d88f6fbff6623ed2047436cecd4f561a74883171ea6f4ebe0a1129973c"
|
|
689
689
|
},
|
|
690
690
|
ucdMintValidator: {
|
|
691
|
-
cid: "
|
|
691
|
+
cid: "QmPir8F8jmJ4ssQpEC3xFxkEnZxMHcgS6VxBQE1jkTLj5K",
|
|
692
692
|
authorizedCidHex: cidToHex(
|
|
693
|
-
"
|
|
693
|
+
"QmPir8F8jmJ4ssQpEC3xFxkEnZxMHcgS6VxBQE1jkTLj5K"
|
|
694
694
|
),
|
|
695
695
|
name: "Ucd Mint Validator",
|
|
696
696
|
description: "Production Ucd Mint Validator",
|
|
697
697
|
version: "1.0.0",
|
|
698
698
|
deployed: true,
|
|
699
|
-
deployedAt:
|
|
700
|
-
size:
|
|
701
|
-
hash: "
|
|
702
|
-
validatorWalletAddress: "
|
|
699
|
+
deployedAt: 1781542207366,
|
|
700
|
+
size: 72074,
|
|
701
|
+
hash: "567a51d3beaedbda4f0af2636835ca8a2af89c2264e91f8dc31f522c1a424b7b",
|
|
702
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
703
703
|
pkp: {
|
|
704
704
|
publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
|
|
705
705
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
706
706
|
}
|
|
707
707
|
},
|
|
708
708
|
processPaymentValidator: {
|
|
709
|
-
cid: "
|
|
709
|
+
cid: "QmVq19NXJEpMMvaWQdsU5czLoqh28WGWoGgKMSYFaCmfa9",
|
|
710
710
|
authorizedCidHex: cidToHex(
|
|
711
|
-
"
|
|
711
|
+
"QmVq19NXJEpMMvaWQdsU5czLoqh28WGWoGgKMSYFaCmfa9"
|
|
712
712
|
),
|
|
713
713
|
name: "Process Payment Validator",
|
|
714
714
|
description: "Production Process Payment Validator",
|
|
715
715
|
version: "1.0.0",
|
|
716
716
|
deployed: true,
|
|
717
|
-
deployedAt:
|
|
718
|
-
size:
|
|
719
|
-
hash: "
|
|
720
|
-
validatorWalletAddress: "
|
|
717
|
+
deployedAt: 1781542209526,
|
|
718
|
+
size: 68239,
|
|
719
|
+
hash: "ada27fea57aa3f3b861c49e75ed1f80b72500fdccc1d6e88ee1a3c1396b81867",
|
|
720
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
721
721
|
pkp: {
|
|
722
722
|
publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
|
|
723
723
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
724
724
|
}
|
|
725
725
|
},
|
|
726
726
|
extendPositionValidator: {
|
|
727
|
-
cid: "
|
|
727
|
+
cid: "QmP2u3bgKLtfqsFMp6Li72zMY8ZZH3ttAqp9W2wwonUmcb",
|
|
728
728
|
authorizedCidHex: cidToHex(
|
|
729
|
-
"
|
|
729
|
+
"QmP2u3bgKLtfqsFMp6Li72zMY8ZZH3ttAqp9W2wwonUmcb"
|
|
730
730
|
),
|
|
731
731
|
name: "Extend Position Validator",
|
|
732
732
|
description: "Production Extend Position Validator",
|
|
733
733
|
version: "1.0.1",
|
|
734
734
|
deployed: true,
|
|
735
|
-
deployedAt:
|
|
736
|
-
size:
|
|
737
|
-
hash: "
|
|
738
|
-
validatorWalletAddress: "
|
|
735
|
+
deployedAt: 1781542211640,
|
|
736
|
+
size: 66543,
|
|
737
|
+
hash: "0db666fa2888e9acea13d8e4d79edd4ca252f5a4bb06d97e53aa14a9a34b7143",
|
|
738
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
739
739
|
pkp: {
|
|
740
740
|
publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
|
|
741
741
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
742
742
|
}
|
|
743
743
|
},
|
|
744
744
|
btcWithdrawal: {
|
|
745
|
-
cid: "
|
|
745
|
+
cid: "QmXtmLdGuEqMKKAtV7d8sHpUV32Kt74na4dRQdpWLasbHJ",
|
|
746
746
|
authorizedCidHex: cidToHex(
|
|
747
|
-
"
|
|
747
|
+
"QmXtmLdGuEqMKKAtV7d8sHpUV32Kt74na4dRQdpWLasbHJ"
|
|
748
748
|
),
|
|
749
749
|
name: "Btc Withdrawal",
|
|
750
750
|
description: "Production Btc Withdrawal",
|
|
751
751
|
version: "1.0.0",
|
|
752
752
|
deployed: true,
|
|
753
|
-
deployedAt:
|
|
754
|
-
size:
|
|
755
|
-
hash: "
|
|
756
|
-
validatorWalletAddress: "
|
|
753
|
+
deployedAt: 1781542212709,
|
|
754
|
+
size: 79782,
|
|
755
|
+
hash: "e824eb473df8eba3a025ac3adc46730dbf89f90884d7c05a78cc07b90d6bc4df",
|
|
756
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
757
757
|
pkp: {
|
|
758
758
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
759
759
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
760
760
|
}
|
|
761
761
|
},
|
|
762
762
|
liquidationValidator: {
|
|
763
|
-
cid: "
|
|
763
|
+
cid: "QmVicBXuZVY8t4DXLPjvXjzLqnBtnogAh5HT7BaL9VeDwF",
|
|
764
764
|
authorizedCidHex: cidToHex(
|
|
765
|
-
"
|
|
765
|
+
"QmVicBXuZVY8t4DXLPjvXjzLqnBtnogAh5HT7BaL9VeDwF"
|
|
766
766
|
),
|
|
767
767
|
name: "Liquidation Validator",
|
|
768
768
|
description: "Production Liquidation Validator",
|
|
769
769
|
version: "1.0.0",
|
|
770
770
|
deployed: true,
|
|
771
|
-
deployedAt:
|
|
772
|
-
size:
|
|
773
|
-
hash: "
|
|
774
|
-
validatorWalletAddress: "
|
|
771
|
+
deployedAt: 1781542213421,
|
|
772
|
+
size: 58444,
|
|
773
|
+
hash: "0f42e9f8984433fef95875d35eb3c8d985e7ce15ad309e6aa1093d6fd1ba0bb5",
|
|
774
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
775
775
|
pkp: {
|
|
776
776
|
publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
|
|
777
777
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
@@ -796,18 +796,18 @@ var DH_LIT_ACTIONS_CHIPOTLE = {
|
|
|
796
796
|
}
|
|
797
797
|
},
|
|
798
798
|
loanVaultBtcBalance: {
|
|
799
|
-
cid: "
|
|
799
|
+
cid: "QmUmqL4LcjDSpw2TtuWMcw8xYk8hPxgagY2qHDU8Mx1PLG",
|
|
800
800
|
authorizedCidHex: cidToHex(
|
|
801
|
-
"
|
|
801
|
+
"QmUmqL4LcjDSpw2TtuWMcw8xYk8hPxgagY2qHDU8Mx1PLG"
|
|
802
802
|
),
|
|
803
803
|
name: "Loan Vault Btc Balance",
|
|
804
804
|
description: "Production Loan Vault Btc Balance",
|
|
805
805
|
version: "1.0.0",
|
|
806
806
|
deployed: true,
|
|
807
|
-
deployedAt:
|
|
808
|
-
size:
|
|
809
|
-
hash: "
|
|
810
|
-
validatorWalletAddress: "
|
|
807
|
+
deployedAt: 1781542215432,
|
|
808
|
+
size: 48397,
|
|
809
|
+
hash: "da3750a70e532b87f3590a3e2d8c2d51e700589f6e111bb291384ab01304af35",
|
|
810
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
811
811
|
pkp: {
|
|
812
812
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
813
813
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
@@ -820,18 +820,18 @@ var DH_LIT_ACTIONS_CHIPOTLE = {
|
|
|
820
820
|
// Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
|
|
821
821
|
// on each target chain (the action decrypts registry slots). No OAR entry.
|
|
822
822
|
btcAddressBalance: {
|
|
823
|
-
cid: "
|
|
823
|
+
cid: "QmWRDAg7ZCBFFhGfdXR7aUtQsG5qqBb1yVdLCxh8dPD7G5",
|
|
824
824
|
authorizedCidHex: cidToHex(
|
|
825
|
-
"
|
|
825
|
+
"QmWRDAg7ZCBFFhGfdXR7aUtQsG5qqBb1yVdLCxh8dPD7G5"
|
|
826
826
|
),
|
|
827
827
|
name: "Btc Address Balance",
|
|
828
828
|
description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
|
|
829
829
|
version: "0.1.0",
|
|
830
830
|
deployed: true,
|
|
831
|
-
deployedAt:
|
|
832
|
-
size:
|
|
833
|
-
hash: "
|
|
834
|
-
validatorWalletAddress: "
|
|
831
|
+
deployedAt: 1781542217452,
|
|
832
|
+
size: 25519,
|
|
833
|
+
hash: "000e2f8bdbccdc95b0db0fb3f12412e2e76eea16a8456d37914d324437ae291c",
|
|
834
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
835
835
|
pkp: {
|
|
836
836
|
publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
|
|
837
837
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
@@ -864,18 +864,18 @@ var DH_LIT_ACTIONS_CHIPOTLE = {
|
|
|
864
864
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
865
865
|
},
|
|
866
866
|
staleSpendRecoveryValidator: {
|
|
867
|
-
cid: "
|
|
867
|
+
cid: "QmWqJZqoKUqMaGTXe9WUSwdDyeBwXJ9dnR3ioFnVK4RkN5",
|
|
868
868
|
authorizedCidHex: cidToHex(
|
|
869
|
-
"
|
|
869
|
+
"QmWqJZqoKUqMaGTXe9WUSwdDyeBwXJ9dnR3ioFnVK4RkN5"
|
|
870
870
|
),
|
|
871
871
|
name: "Stale Spend Recovery Validator",
|
|
872
872
|
description: "Production Stale Spend Recovery Validator",
|
|
873
873
|
version: "1.0.0",
|
|
874
874
|
deployed: true,
|
|
875
|
-
deployedAt:
|
|
876
|
-
size:
|
|
877
|
-
hash: "
|
|
878
|
-
validatorWalletAddress: "
|
|
875
|
+
deployedAt: 1781542219438,
|
|
876
|
+
size: 34413,
|
|
877
|
+
hash: "26b11730cf5d9eb4af0b1fe65192d26ccee50369c0472211a0ea11e26ef51cc5",
|
|
878
|
+
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
879
879
|
pkp: {
|
|
880
880
|
publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
|
|
881
881
|
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
@@ -2572,6 +2572,68 @@ function isAbortError(error) {
|
|
|
2572
2572
|
return error instanceof Error && error.name === "AbortError";
|
|
2573
2573
|
}
|
|
2574
2574
|
|
|
2575
|
+
// src/modules/bitcoin-provider-auth.ts
|
|
2576
|
+
var BLOCKSTREAM_TOKEN_URL = "https://login.blockstream.com/realms/blockstream-public/protocol/openid-connect/token";
|
|
2577
|
+
var oauthTokenCache = /* @__PURE__ */ new Map();
|
|
2578
|
+
var OAUTH_TOKEN_TIMEOUT_MS = 1e4;
|
|
2579
|
+
async function getBlockstreamBearerToken(auth, timeoutMs) {
|
|
2580
|
+
const tokenUrl = auth.tokenUrl || BLOCKSTREAM_TOKEN_URL;
|
|
2581
|
+
const key = `${tokenUrl}
|
|
2582
|
+
${auth.clientId}`;
|
|
2583
|
+
const cached = oauthTokenCache.get(key);
|
|
2584
|
+
if (cached) return cached;
|
|
2585
|
+
const promise = (async () => {
|
|
2586
|
+
const body = `grant_type=client_credentials&client_id=${encodeURIComponent(auth.clientId)}&client_secret=${encodeURIComponent(auth.clientSecret)}&scope=openid`;
|
|
2587
|
+
const controller = new AbortController();
|
|
2588
|
+
const timeoutId = setTimeout(
|
|
2589
|
+
() => controller.abort(),
|
|
2590
|
+
timeoutMs && timeoutMs > 0 ? timeoutMs : OAUTH_TOKEN_TIMEOUT_MS
|
|
2591
|
+
);
|
|
2592
|
+
let resp;
|
|
2593
|
+
try {
|
|
2594
|
+
resp = await fetch(tokenUrl, {
|
|
2595
|
+
method: "POST",
|
|
2596
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
2597
|
+
body,
|
|
2598
|
+
signal: controller.signal
|
|
2599
|
+
});
|
|
2600
|
+
} finally {
|
|
2601
|
+
clearTimeout(timeoutId);
|
|
2602
|
+
}
|
|
2603
|
+
if (!resp.ok) {
|
|
2604
|
+
throw new Error(
|
|
2605
|
+
`Blockstream OAuth token exchange failed: ${resp.status} ${resp.statusText}`
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
const json = await resp.json();
|
|
2609
|
+
const token = json?.access_token;
|
|
2610
|
+
if (typeof token !== "string" || token.length === 0) {
|
|
2611
|
+
throw new Error(
|
|
2612
|
+
"Blockstream OAuth token exchange returned no access_token"
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
return token;
|
|
2616
|
+
})();
|
|
2617
|
+
promise.catch(() => oauthTokenCache.delete(key));
|
|
2618
|
+
oauthTokenCache.set(key, promise);
|
|
2619
|
+
return promise;
|
|
2620
|
+
}
|
|
2621
|
+
async function authHeaders(auth, timeoutMs) {
|
|
2622
|
+
if (!auth) return {};
|
|
2623
|
+
switch (auth.provider) {
|
|
2624
|
+
case "esplora":
|
|
2625
|
+
return {};
|
|
2626
|
+
case "maestro":
|
|
2627
|
+
return { "api-key": auth.apiKey };
|
|
2628
|
+
case "blockstream-enterprise": {
|
|
2629
|
+
const token = await getBlockstreamBearerToken(auth, timeoutMs);
|
|
2630
|
+
return { Authorization: `Bearer ${token}` };
|
|
2631
|
+
}
|
|
2632
|
+
default:
|
|
2633
|
+
return {};
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2575
2637
|
// src/modules/bitcoin-data-provider.module.ts
|
|
2576
2638
|
var BitcoinDataProvider = class {
|
|
2577
2639
|
constructor(config) {
|
|
@@ -2579,6 +2641,15 @@ var BitcoinDataProvider = class {
|
|
|
2579
2641
|
this.timeout = config.timeout || 15e3;
|
|
2580
2642
|
this.logger = LitActionLogger.create("BitcoinDataProvider");
|
|
2581
2643
|
}
|
|
2644
|
+
/**
|
|
2645
|
+
* Merge per-provider auth headers into a base header set. No-op for public
|
|
2646
|
+
* Esplora / regtest faucet (no `auth`); attaches the `api-key` header for
|
|
2647
|
+
* Maestro and performs a (memoized) OAuth exchange → `Bearer` for Blockstream
|
|
2648
|
+
* Enterprise. Awaited at every fetch site so a single run shares one token.
|
|
2649
|
+
*/
|
|
2650
|
+
async withAuth(base2 = {}) {
|
|
2651
|
+
return { ...base2, ...await authHeaders(this.config.auth, this.timeout) };
|
|
2652
|
+
}
|
|
2582
2653
|
/**
|
|
2583
2654
|
* Get current Bitcoin block height from provider
|
|
2584
2655
|
*/
|
|
@@ -2597,11 +2668,11 @@ var BitcoinDataProvider = class {
|
|
|
2597
2668
|
`${this.config.providerUrl}/blocks/tip/height`,
|
|
2598
2669
|
{
|
|
2599
2670
|
signal: controller.signal,
|
|
2600
|
-
headers: {
|
|
2671
|
+
headers: await this.withAuth({
|
|
2601
2672
|
Accept: "text/plain",
|
|
2602
2673
|
"User-Agent": "Mozilla/5.0 (compatible; DiamondHandsValidator/1.0)",
|
|
2603
2674
|
"ngrok-skip-browser-warning": "true"
|
|
2604
|
-
}
|
|
2675
|
+
})
|
|
2605
2676
|
}
|
|
2606
2677
|
);
|
|
2607
2678
|
clearTimeout(timeoutId);
|
|
@@ -2771,12 +2842,12 @@ var BitcoinDataProvider = class {
|
|
|
2771
2842
|
* Internal method to fetch UTXOs from a specific provider
|
|
2772
2843
|
*
|
|
2773
2844
|
* Supports standard Esplora API format:
|
|
2774
|
-
* - Standard format: {providerUrl}/address/{address}/
|
|
2845
|
+
* - Standard format: {providerUrl}/address/{address}/utxo
|
|
2775
2846
|
* - providerUrl must include full base path (e.g., "http://localhost:3002/api/esplora")
|
|
2776
2847
|
*/
|
|
2777
2848
|
async fetchUTXOsFromProvider(providerUrl, address) {
|
|
2778
2849
|
this.logger.stepStart("1", "fetchUTXOsFromProvider");
|
|
2779
|
-
const endpoint = `${providerUrl}/address/${address}/
|
|
2850
|
+
const endpoint = `${providerUrl}/address/${address}/utxo`;
|
|
2780
2851
|
this.logger.log("1", `Fetching UTXOs from ${endpoint}`);
|
|
2781
2852
|
const controller = new AbortController();
|
|
2782
2853
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
@@ -2786,18 +2857,18 @@ var BitcoinDataProvider = class {
|
|
|
2786
2857
|
this.getCurrentBlockHeight(),
|
|
2787
2858
|
fetch(endpoint, {
|
|
2788
2859
|
signal: controller.signal,
|
|
2789
|
-
headers: {
|
|
2860
|
+
headers: await this.withAuth({
|
|
2790
2861
|
Accept: "application/json",
|
|
2791
2862
|
"Content-Type": "application/json",
|
|
2792
2863
|
"User-Agent": "Mozilla/5.0 (compatible; DiamondHandsValidator/1.0)",
|
|
2793
2864
|
"ngrok-skip-browser-warning": "true"
|
|
2794
2865
|
// Skip ngrok browser warning page
|
|
2795
|
-
}
|
|
2866
|
+
})
|
|
2796
2867
|
})
|
|
2797
2868
|
]);
|
|
2798
2869
|
clearTimeout(timeoutId);
|
|
2799
2870
|
litDebugLog(
|
|
2800
|
-
`[BitcoinDataProvider] parallel(tipHeight + GET
|
|
2871
|
+
`[BitcoinDataProvider] parallel(tipHeight + GET utxo) wall ${Date.now() - tParallel}ms endpoint tail .../${address.slice(0, 12)}.../utxo (timeout budget ${this.timeout}ms)`
|
|
2801
2872
|
);
|
|
2802
2873
|
this.logger.log("1", `Current block height: ${currentBlockHeight}`);
|
|
2803
2874
|
if (!response.ok) {
|
|
@@ -2909,12 +2980,12 @@ var BitcoinDataProvider = class {
|
|
|
2909
2980
|
const t0 = Date.now();
|
|
2910
2981
|
const response = await fetch(endpoint, {
|
|
2911
2982
|
signal: controller.signal,
|
|
2912
|
-
headers: {
|
|
2983
|
+
headers: await this.withAuth({
|
|
2913
2984
|
Accept: "application/json",
|
|
2914
2985
|
"Content-Type": "application/json",
|
|
2915
2986
|
"User-Agent": "Mozilla/5.0 (compatible; DiamondHandsValidator/1.0)",
|
|
2916
2987
|
"ngrok-skip-browser-warning": "true"
|
|
2917
|
-
}
|
|
2988
|
+
})
|
|
2918
2989
|
});
|
|
2919
2990
|
clearTimeout(timeoutId);
|
|
2920
2991
|
litDebugLog(
|
|
@@ -2988,7 +3059,8 @@ var BitcoinDataProvider = class {
|
|
|
2988
3059
|
try {
|
|
2989
3060
|
const t0 = Date.now();
|
|
2990
3061
|
const response = await fetch(`${this.config.providerUrl}/tx/${txid}`, {
|
|
2991
|
-
signal: controller.signal
|
|
3062
|
+
signal: controller.signal,
|
|
3063
|
+
headers: await this.withAuth()
|
|
2992
3064
|
});
|
|
2993
3065
|
clearTimeout(timeoutId);
|
|
2994
3066
|
litDebugLog(
|
|
@@ -3010,7 +3082,7 @@ var BitcoinDataProvider = class {
|
|
|
3010
3082
|
try {
|
|
3011
3083
|
const tipResp = await fetch(
|
|
3012
3084
|
`${this.config.providerUrl}/blocks/tip/height`,
|
|
3013
|
-
{ signal: controller.signal }
|
|
3085
|
+
{ signal: controller.signal, headers: await this.withAuth() }
|
|
3014
3086
|
);
|
|
3015
3087
|
if (!tipResp.ok) {
|
|
3016
3088
|
return { txid: data.txid ?? txid, confirmations: 1 };
|
|
@@ -3061,7 +3133,8 @@ var BitcoinDataProvider = class {
|
|
|
3061
3133
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
3062
3134
|
try {
|
|
3063
3135
|
const response = await fetch(`${this.config.providerUrl}/tx/${txid}`, {
|
|
3064
|
-
signal: controller.signal
|
|
3136
|
+
signal: controller.signal,
|
|
3137
|
+
headers: await this.withAuth()
|
|
3065
3138
|
});
|
|
3066
3139
|
clearTimeout(timeoutId);
|
|
3067
3140
|
if (!response.ok) {
|