opnet 1.8.5 → 1.8.7
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/CHANGELOG.md +22 -0
- package/browser/_version.d.ts +1 -1
- package/browser/block/BlockWitness.d.ts +0 -1
- package/browser/block/interfaces/IBlockWitness.d.ts +0 -2
- package/browser/index.js +39 -45
- package/browser/providers/AbstractRpcProvider.d.ts +1 -1
- package/browser/utxos/UTXOsManager.d.ts +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/shared/json/opnet/OP_721_ABI.js +32 -28
- package/build/block/BlockWitness.d.ts +0 -1
- package/build/block/BlockWitness.js +0 -2
- package/build/block/interfaces/IBlockWitness.d.ts +0 -2
- package/build/providers/AbstractRpcProvider.d.ts +1 -1
- package/build/providers/AbstractRpcProvider.js +1 -3
- package/build/providers/WebsocketRpcProvider.js +0 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/utxos/UTXOsManager.d.ts +1 -1
- package/build/utxos/UTXOsManager.js +13 -10
- package/docs/abi-reference/op721-abi.md +50 -25
- package/package.json +4 -4
- package/src/_version.ts +1 -1
- package/src/abi/shared/json/opnet/OP_721_ABI.ts +32 -28
- package/src/block/BlockWitness.ts +0 -2
- package/src/block/interfaces/IBlockWitness.ts +0 -2
- package/src/providers/AbstractRpcProvider.ts +1 -4
- package/src/providers/WebsocketRpcProvider.ts +1 -2
- package/src/utxos/UTXOsManager.ts +13 -10
- package/test/mempool.test.ts +16 -15
- package/test/utxos-manager.test.ts +55 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.8.6] - 2026-03-17
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Remove trusted from BlockWitness and providers ([#147](https://github.com/btc-vision/opnet/pull/147)) by @BlobMaster41
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## [v1.8.5] - 2026-03-13
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- Fix/bug with building tx ([#146](https://github.com/btc-vision/opnet/pull/146)) by @BlobMaster41
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- Fix/bug with building tx ([#146](https://github.com/btc-vision/opnet/pull/146)) by @BlobMaster41
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
3
25
|
## [v1.8.3] - 2026-03-09
|
|
4
26
|
|
|
5
27
|
### Features
|
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.8.
|
|
1
|
+
export declare const version = "1.8.7";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Address } from '../../node_modules/@btc-vision/transaction/build/index.js';
|
|
2
2
|
import { BlockWitnesses, IBlockWitness, IBlockWitnessAPI, RawBlockWitnessAPI } from './interfaces/IBlockWitness.js';
|
|
3
3
|
export declare class BlockWitnessAPI implements IBlockWitnessAPI {
|
|
4
|
-
readonly trusted: boolean;
|
|
5
4
|
readonly signature: Uint8Array;
|
|
6
5
|
readonly timestamp: number;
|
|
7
6
|
readonly proofs: readonly Uint8Array[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Address } from '../../../node_modules/@btc-vision/transaction/build/index.js';
|
|
2
2
|
export interface IBlockWitnessAPI {
|
|
3
|
-
readonly trusted: boolean;
|
|
4
3
|
readonly signature: Uint8Array;
|
|
5
4
|
readonly timestamp: number;
|
|
6
5
|
readonly proofs: readonly Uint8Array[];
|
|
@@ -8,7 +7,6 @@ export interface IBlockWitnessAPI {
|
|
|
8
7
|
readonly publicKey?: Address;
|
|
9
8
|
}
|
|
10
9
|
export interface RawBlockWitnessAPI {
|
|
11
|
-
readonly trusted: boolean;
|
|
12
10
|
readonly signature: string;
|
|
13
11
|
readonly timestamp: number;
|
|
14
12
|
readonly proofs: readonly string[];
|
package/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { a as __toESM, r as __exportAll } from "./rolldown-runtime.js";
|
|
|
2
2
|
import { A as bitcoin, C as AddressVerificator, D as fromHex, E as toBase64, M as regtest, N as testnet, O as toHex, S as AddressTypes, T as fromBase64, _ as BinaryWriter, a as ABICoder, b as AddressMap, c as isAbiTuple, d as process$1, f as P2MR_MS, g as Logger, h as TransactionFactory, i as NetEvent, j as opnetTestnet, k as fromBech32, l as ABIDataTypes, m as ChallengeSolution, n as Long, o as abiTypeToSelectorString, p as P2TR_MS, r as pLimit, s as isAbiStruct, t as BigNumber, u as init_dist, v as BinaryReader, w as decompile, x as Address, y as BufferHelper } from "./vendors.js";
|
|
3
3
|
import { t as require_protobuf_min } from "./protobuf.js";
|
|
4
4
|
//#region src/_version.ts
|
|
5
|
-
var version = "1.8.
|
|
5
|
+
var version = "1.8.7";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/interfaces/opnet/OPNetTransactionTypes.ts
|
|
8
8
|
var OPNetTransactionTypes = /* @__PURE__ */ function(OPNetTransactionTypes) {
|
|
@@ -548,14 +548,12 @@ function stringBase64ToBuffer(str) {
|
|
|
548
548
|
//#endregion
|
|
549
549
|
//#region src/block/BlockWitness.ts
|
|
550
550
|
var BlockWitnessAPI = class {
|
|
551
|
-
trusted;
|
|
552
551
|
signature;
|
|
553
552
|
timestamp;
|
|
554
553
|
proofs;
|
|
555
554
|
identity;
|
|
556
555
|
publicKey;
|
|
557
556
|
constructor(data) {
|
|
558
|
-
this.trusted = data.trusted;
|
|
559
557
|
this.signature = stringBase64ToBuffer(data.signature);
|
|
560
558
|
this.timestamp = data.timestamp;
|
|
561
559
|
this.proofs = Object.freeze(data.proofs.map((proof) => stringBase64ToBuffer(proof)));
|
|
@@ -1957,9 +1955,9 @@ var UTXOsManager = class {
|
|
|
1957
1955
|
/**
|
|
1958
1956
|
* Clean (reset) the data for a particular address or for all addresses if none is passed.
|
|
1959
1957
|
*/
|
|
1960
|
-
clean(address) {
|
|
1958
|
+
clean(address, threshold) {
|
|
1961
1959
|
if (address) {
|
|
1962
|
-
const addressData = this.getAddressData(address);
|
|
1960
|
+
const addressData = this.getAddressData(address, threshold);
|
|
1963
1961
|
addressData.spentUTXOs = [];
|
|
1964
1962
|
addressData.pendingUTXOs = [];
|
|
1965
1963
|
addressData.pendingUtxoDepth = {};
|
|
@@ -1985,7 +1983,7 @@ var UTXOsManager = class {
|
|
|
1985
1983
|
* @throws {Error} If something goes wrong
|
|
1986
1984
|
*/
|
|
1987
1985
|
async getUTXOs({ address, isCSV = false, optimize = true, mergePendingUTXOs = true, filterSpentUTXOs = true, olderThan }) {
|
|
1988
|
-
const addressData = this.getAddressData(address);
|
|
1986
|
+
const addressData = this.getAddressData(address, olderThan);
|
|
1989
1987
|
const fetchedData = await this.maybeFetchUTXOs(address, optimize, olderThan, isCSV);
|
|
1990
1988
|
const utxoKey = (utxo) => `${utxo.transactionId}:${utxo.outputIndex}`;
|
|
1991
1989
|
const spentRefKey = (ref) => `${ref.transactionId}:${ref.outputIndex}`;
|
|
@@ -2195,8 +2193,9 @@ var UTXOsManager = class {
|
|
|
2195
2193
|
/**
|
|
2196
2194
|
* Return the AddressData object for a given address. Initializes it if nonexistent.
|
|
2197
2195
|
*/
|
|
2198
|
-
getAddressData(address) {
|
|
2199
|
-
|
|
2196
|
+
getAddressData(address, threshold) {
|
|
2197
|
+
const addressWithThreshold = threshold ? `${address}_${threshold}` : address;
|
|
2198
|
+
if (!this.dataByAddress[addressWithThreshold]) this.dataByAddress[addressWithThreshold] = {
|
|
2200
2199
|
spentUTXOs: [],
|
|
2201
2200
|
pendingUTXOs: [],
|
|
2202
2201
|
pendingUtxoDepth: {},
|
|
@@ -2204,20 +2203,20 @@ var UTXOsManager = class {
|
|
|
2204
2203
|
lastFetchTimestamp: 0,
|
|
2205
2204
|
lastFetchedData: null
|
|
2206
2205
|
};
|
|
2207
|
-
return this.dataByAddress[
|
|
2206
|
+
return this.dataByAddress[addressWithThreshold];
|
|
2208
2207
|
}
|
|
2209
2208
|
/**
|
|
2210
2209
|
* Checks if we need to fetch fresh UTXOs or can return the cached data (per address).
|
|
2211
2210
|
*/
|
|
2212
2211
|
async maybeFetchUTXOs(address, optimize, olderThan, isCSV = false) {
|
|
2213
|
-
const addressData = this.getAddressData(address);
|
|
2212
|
+
const addressData = this.getAddressData(address, olderThan);
|
|
2214
2213
|
const now = Date.now();
|
|
2215
2214
|
const age = now - addressData.lastFetchTimestamp;
|
|
2216
|
-
if (now - addressData.lastCleanup > AUTO_PURGE_AFTER) this.clean(address);
|
|
2215
|
+
if (now - addressData.lastCleanup > AUTO_PURGE_AFTER) this.clean(address, olderThan);
|
|
2217
2216
|
if (addressData.lastFetchedData && age < FETCH_COOLDOWN) return addressData.lastFetchedData;
|
|
2218
2217
|
addressData.lastFetchedData = await this.fetchUTXOs(address, optimize, olderThan, isCSV);
|
|
2219
2218
|
addressData.lastFetchTimestamp = now;
|
|
2220
|
-
this.syncPendingDepthWithFetched(address);
|
|
2219
|
+
if (!olderThan) this.syncPendingDepthWithFetched(address);
|
|
2221
2220
|
return addressData.lastFetchedData;
|
|
2222
2221
|
}
|
|
2223
2222
|
/**
|
|
@@ -2695,16 +2694,14 @@ var AbstractRpcProvider = class {
|
|
|
2695
2694
|
* Get block witnesses.
|
|
2696
2695
|
* @description This method is used to get the witnesses of a block. This proves that the actions executed inside a block are valid and confirmed by the network. If the minimum number of witnesses are not met, the block is considered as potentially invalid.
|
|
2697
2696
|
* @param {BlockTag} height The block number or hash, use -1 for latest block
|
|
2698
|
-
* @param {boolean} [trusted] Whether to trust the witnesses or not
|
|
2699
2697
|
* @param {number} [limit] The maximum number of witnesses to return
|
|
2700
2698
|
* @param {number} [page] The page number of the witnesses
|
|
2701
2699
|
* @returns {Promise<BlockWitnesses>} The witnesses of the block
|
|
2702
2700
|
* @example await getBlockWitness(123456n);
|
|
2703
2701
|
* @throws {Error} If something went wrong while fetching the witnesses
|
|
2704
2702
|
*/
|
|
2705
|
-
async getBlockWitness(height = -1,
|
|
2703
|
+
async getBlockWitness(height = -1, limit, page) {
|
|
2706
2704
|
const params = [height.toString()];
|
|
2707
|
-
if (trusted !== void 0 && trusted !== null) params.push(trusted);
|
|
2708
2705
|
if (limit !== void 0 && limit !== null) params.push(limit);
|
|
2709
2706
|
if (page !== void 0 && page !== null) params.push(page);
|
|
2710
2707
|
const payload = this.buildJsonRpcPayload(JSONRpcMethods.BLOCK_WITNESS, params);
|
|
@@ -4472,8 +4469,7 @@ var WebSocketRpcProvider = class extends AbstractRpcProvider {
|
|
|
4472
4469
|
case JSONRpcMethods.BLOCK_WITNESS: return {
|
|
4473
4470
|
2: Long.fromString(String(params[0] ?? -1)),
|
|
4474
4471
|
3: params[1],
|
|
4475
|
-
4: params[2]
|
|
4476
|
-
5: params[3]
|
|
4472
|
+
4: params[2]
|
|
4477
4473
|
};
|
|
4478
4474
|
case JSONRpcMethods.GAS: return {};
|
|
4479
4475
|
case JSONRpcMethods.GET_TRANSACTION_BY_HASH: return { 2: params[0] };
|
|
@@ -8863,7 +8859,7 @@ var OP721Events = [
|
|
|
8863
8859
|
type: ABIDataTypes.ADDRESS
|
|
8864
8860
|
},
|
|
8865
8861
|
{
|
|
8866
|
-
name: "
|
|
8862
|
+
name: "tokenId",
|
|
8867
8863
|
type: ABIDataTypes.UINT256
|
|
8868
8864
|
}
|
|
8869
8865
|
],
|
|
@@ -8877,11 +8873,11 @@ var OP721Events = [
|
|
|
8877
8873
|
type: ABIDataTypes.ADDRESS
|
|
8878
8874
|
},
|
|
8879
8875
|
{
|
|
8880
|
-
name: "
|
|
8876
|
+
name: "operator",
|
|
8881
8877
|
type: ABIDataTypes.ADDRESS
|
|
8882
8878
|
},
|
|
8883
8879
|
{
|
|
8884
|
-
name: "
|
|
8880
|
+
name: "tokenId",
|
|
8885
8881
|
type: ABIDataTypes.UINT256
|
|
8886
8882
|
}
|
|
8887
8883
|
],
|
|
@@ -8905,6 +8901,28 @@ var OP721Events = [
|
|
|
8905
8901
|
],
|
|
8906
8902
|
type: BitcoinAbiTypes.Event
|
|
8907
8903
|
},
|
|
8904
|
+
{
|
|
8905
|
+
name: "Burned",
|
|
8906
|
+
values: [{
|
|
8907
|
+
name: "from",
|
|
8908
|
+
type: ABIDataTypes.ADDRESS
|
|
8909
|
+
}, {
|
|
8910
|
+
name: "tokenId",
|
|
8911
|
+
type: ABIDataTypes.UINT256
|
|
8912
|
+
}],
|
|
8913
|
+
type: BitcoinAbiTypes.Event
|
|
8914
|
+
},
|
|
8915
|
+
{
|
|
8916
|
+
name: "Minted",
|
|
8917
|
+
values: [{
|
|
8918
|
+
name: "to",
|
|
8919
|
+
type: ABIDataTypes.ADDRESS
|
|
8920
|
+
}, {
|
|
8921
|
+
name: "tokenId",
|
|
8922
|
+
type: ABIDataTypes.UINT256
|
|
8923
|
+
}],
|
|
8924
|
+
type: BitcoinAbiTypes.Event
|
|
8925
|
+
},
|
|
8908
8926
|
{
|
|
8909
8927
|
name: "URI",
|
|
8910
8928
|
values: [{
|
|
@@ -8951,30 +8969,6 @@ var OP_721_ABI = [
|
|
|
8951
8969
|
type: ABIDataTypes.UINT256
|
|
8952
8970
|
}]
|
|
8953
8971
|
},
|
|
8954
|
-
{
|
|
8955
|
-
name: "collectionInfo",
|
|
8956
|
-
type: BitcoinAbiTypes.Function,
|
|
8957
|
-
constant: true,
|
|
8958
|
-
inputs: [],
|
|
8959
|
-
outputs: [
|
|
8960
|
-
{
|
|
8961
|
-
name: "icon",
|
|
8962
|
-
type: ABIDataTypes.STRING
|
|
8963
|
-
},
|
|
8964
|
-
{
|
|
8965
|
-
name: "banner",
|
|
8966
|
-
type: ABIDataTypes.STRING
|
|
8967
|
-
},
|
|
8968
|
-
{
|
|
8969
|
-
name: "description",
|
|
8970
|
-
type: ABIDataTypes.STRING
|
|
8971
|
-
},
|
|
8972
|
-
{
|
|
8973
|
-
name: "website",
|
|
8974
|
-
type: ABIDataTypes.STRING
|
|
8975
|
-
}
|
|
8976
|
-
]
|
|
8977
|
-
},
|
|
8978
8972
|
{
|
|
8979
8973
|
name: "tokenURI",
|
|
8980
8974
|
type: BitcoinAbiTypes.Function,
|
|
@@ -9220,7 +9214,7 @@ var OP_721_ABI = [
|
|
|
9220
9214
|
}]
|
|
9221
9215
|
},
|
|
9222
9216
|
{
|
|
9223
|
-
name: "
|
|
9217
|
+
name: "nonceOf",
|
|
9224
9218
|
type: BitcoinAbiTypes.Function,
|
|
9225
9219
|
constant: true,
|
|
9226
9220
|
inputs: [{
|
|
@@ -61,7 +61,7 @@ export declare abstract class AbstractRpcProvider {
|
|
|
61
61
|
sendRawTransaction(tx: string, psbt: boolean): Promise<BroadcastedTransaction>;
|
|
62
62
|
sendRawTransactions(txs: string[]): Promise<BroadcastedTransaction[]>;
|
|
63
63
|
sendRawTransactionPackage(txs: string[], isPackage?: boolean): Promise<BroadcastedTransactionPackage>;
|
|
64
|
-
getBlockWitness(height?: BigNumberish,
|
|
64
|
+
getBlockWitness(height?: BigNumberish, limit?: number, page?: number): Promise<BlockWitnesses>;
|
|
65
65
|
getReorg(fromBlock?: BigNumberish, toBlock?: BigNumberish): Promise<ReorgInformation[]>;
|
|
66
66
|
abstract _send(payload: JsonRpcPayload | JsonRpcPayload[]): Promise<JsonRpcCallResult>;
|
|
67
67
|
callPayloadSingle(payload: JsonRpcPayload): Promise<JsonRpcResult>;
|
|
@@ -7,7 +7,7 @@ export declare class UTXOsManager {
|
|
|
7
7
|
constructor(provider: IProviderForUTXO);
|
|
8
8
|
spentUTXO(address: string, spent: UTXOs, newUTXOs: UTXOs): void;
|
|
9
9
|
getPendingUTXOs(address: string): UTXOs;
|
|
10
|
-
clean(address?: string): void;
|
|
10
|
+
clean(address?: string, threshold?: bigint): void;
|
|
11
11
|
getUTXOs({ address, isCSV, optimize, mergePendingUTXOs, filterSpentUTXOs, olderThan, }: RequestUTXOsParams): Promise<UTXOs>;
|
|
12
12
|
getUTXOsForAmount({ address, amount, csvAddress, optimize, mergePendingUTXOs, filterSpentUTXOs, throwErrors, olderThan, maxUTXOs, throwIfUTXOsLimitReached, }: RequestUTXOsParamsWithAmount): Promise<UTXOs>;
|
|
13
13
|
getMultipleUTXOs({ requests, mergePendingUTXOs, filterSpentUTXOs, }: RequestMultipleUTXOsParams): Promise<Record<string, UTXOs>>;
|
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.8.
|
|
1
|
+
export declare const version = "1.8.7";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.8.
|
|
1
|
+
export const version = '1.8.7';
|
|
@@ -18,7 +18,7 @@ export const OP721Events = [
|
|
|
18
18
|
type: ABIDataTypes.ADDRESS,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
name: '
|
|
21
|
+
name: 'tokenId',
|
|
22
22
|
type: ABIDataTypes.UINT256,
|
|
23
23
|
},
|
|
24
24
|
],
|
|
@@ -32,11 +32,11 @@ export const OP721Events = [
|
|
|
32
32
|
type: ABIDataTypes.ADDRESS,
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
name: '
|
|
35
|
+
name: 'operator',
|
|
36
36
|
type: ABIDataTypes.ADDRESS,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
name: '
|
|
39
|
+
name: 'tokenId',
|
|
40
40
|
type: ABIDataTypes.UINT256,
|
|
41
41
|
},
|
|
42
42
|
],
|
|
@@ -60,6 +60,34 @@ export const OP721Events = [
|
|
|
60
60
|
],
|
|
61
61
|
type: BitcoinAbiTypes.Event,
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Burned',
|
|
65
|
+
values: [
|
|
66
|
+
{
|
|
67
|
+
name: 'from',
|
|
68
|
+
type: ABIDataTypes.ADDRESS
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'tokenId',
|
|
72
|
+
type: ABIDataTypes.UINT256
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
type: BitcoinAbiTypes.Event,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Minted',
|
|
79
|
+
values: [
|
|
80
|
+
{
|
|
81
|
+
name: 'to',
|
|
82
|
+
type: ABIDataTypes.ADDRESS,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'tokenId',
|
|
86
|
+
type: ABIDataTypes.UINT256,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
type: BitcoinAbiTypes.Event,
|
|
90
|
+
},
|
|
63
91
|
{
|
|
64
92
|
name: 'URI',
|
|
65
93
|
values: [
|
|
@@ -112,30 +140,6 @@ export const OP_721_ABI = [
|
|
|
112
140
|
},
|
|
113
141
|
],
|
|
114
142
|
},
|
|
115
|
-
{
|
|
116
|
-
name: 'collectionInfo',
|
|
117
|
-
type: BitcoinAbiTypes.Function,
|
|
118
|
-
constant: true,
|
|
119
|
-
inputs: [],
|
|
120
|
-
outputs: [
|
|
121
|
-
{
|
|
122
|
-
name: 'icon',
|
|
123
|
-
type: ABIDataTypes.STRING,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'banner',
|
|
127
|
-
type: ABIDataTypes.STRING,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'description',
|
|
131
|
-
type: ABIDataTypes.STRING,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'website',
|
|
135
|
-
type: ABIDataTypes.STRING,
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
143
|
{
|
|
140
144
|
name: 'tokenURI',
|
|
141
145
|
type: BitcoinAbiTypes.Function,
|
|
@@ -417,7 +421,7 @@ export const OP_721_ABI = [
|
|
|
417
421
|
],
|
|
418
422
|
},
|
|
419
423
|
{
|
|
420
|
-
name: '
|
|
424
|
+
name: 'nonceOf',
|
|
421
425
|
type: BitcoinAbiTypes.Function,
|
|
422
426
|
constant: true,
|
|
423
427
|
inputs: [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { BlockWitnesses, IBlockWitness, IBlockWitnessAPI, RawBlockWitnessAPI } from './interfaces/IBlockWitness.js';
|
|
3
3
|
export declare class BlockWitnessAPI implements IBlockWitnessAPI {
|
|
4
|
-
readonly trusted: boolean;
|
|
5
4
|
readonly signature: Uint8Array;
|
|
6
5
|
readonly timestamp: number;
|
|
7
6
|
readonly proofs: readonly Uint8Array[];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
import { stringBase64ToBuffer } from '../utils/StringToBuffer.js';
|
|
3
3
|
export class BlockWitnessAPI {
|
|
4
|
-
trusted;
|
|
5
4
|
signature;
|
|
6
5
|
timestamp;
|
|
7
6
|
proofs;
|
|
8
7
|
identity;
|
|
9
8
|
publicKey;
|
|
10
9
|
constructor(data) {
|
|
11
|
-
this.trusted = data.trusted;
|
|
12
10
|
this.signature = stringBase64ToBuffer(data.signature);
|
|
13
11
|
this.timestamp = data.timestamp;
|
|
14
12
|
this.proofs = Object.freeze(data.proofs.map((proof) => stringBase64ToBuffer(proof)));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Address } from '@btc-vision/transaction';
|
|
2
2
|
export interface IBlockWitnessAPI {
|
|
3
|
-
readonly trusted: boolean;
|
|
4
3
|
readonly signature: Uint8Array;
|
|
5
4
|
readonly timestamp: number;
|
|
6
5
|
readonly proofs: readonly Uint8Array[];
|
|
@@ -8,7 +7,6 @@ export interface IBlockWitnessAPI {
|
|
|
8
7
|
readonly publicKey?: Address;
|
|
9
8
|
}
|
|
10
9
|
export interface RawBlockWitnessAPI {
|
|
11
|
-
readonly trusted: boolean;
|
|
12
10
|
readonly signature: string;
|
|
13
11
|
readonly timestamp: number;
|
|
14
12
|
readonly proofs: readonly string[];
|
|
@@ -62,7 +62,7 @@ export declare abstract class AbstractRpcProvider {
|
|
|
62
62
|
sendRawTransaction(tx: string, psbt: boolean): Promise<BroadcastedTransaction>;
|
|
63
63
|
sendRawTransactions(txs: string[]): Promise<BroadcastedTransaction[]>;
|
|
64
64
|
sendRawTransactionPackage(txs: string[], isPackage?: boolean): Promise<BroadcastedTransactionPackage>;
|
|
65
|
-
getBlockWitness(height?: BigNumberish,
|
|
65
|
+
getBlockWitness(height?: BigNumberish, limit?: number, page?: number): Promise<BlockWitnesses>;
|
|
66
66
|
getReorg(fromBlock?: BigNumberish, toBlock?: BigNumberish): Promise<ReorgInformation[]>;
|
|
67
67
|
abstract _send(payload: JsonRpcPayload | JsonRpcPayload[]): Promise<JsonRpcCallResult>;
|
|
68
68
|
callPayloadSingle(payload: JsonRpcPayload): Promise<JsonRpcResult>;
|
|
@@ -339,10 +339,8 @@ export class AbstractRpcProvider {
|
|
|
339
339
|
const result = await this.callPayloadSingle(payload);
|
|
340
340
|
return result.result;
|
|
341
341
|
}
|
|
342
|
-
async getBlockWitness(height = -1,
|
|
342
|
+
async getBlockWitness(height = -1, limit, page) {
|
|
343
343
|
const params = [height.toString()];
|
|
344
|
-
if (trusted !== undefined && trusted !== null)
|
|
345
|
-
params.push(trusted);
|
|
346
344
|
if (limit !== undefined && limit !== null)
|
|
347
345
|
params.push(limit);
|
|
348
346
|
if (page !== undefined && page !== null)
|