opnet 1.8.5 → 1.8.6
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 +13 -0
- package/browser/block/BlockWitness.d.ts +0 -1
- package/browser/block/interfaces/IBlockWitness.d.ts +0 -2
- package/browser/index.js +28 -35
- package/browser/providers/AbstractRpcProvider.d.ts +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/docs/abi-reference/op721-abi.md +50 -25
- package/package.json +4 -4
- 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/test/mempool.test.ts +16 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.8.5] - 2026-03-13
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Fix/bug with building tx ([#146](https://github.com/btc-vision/opnet/pull/146)) by @BlobMaster41
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- Fix/bug with building tx ([#146](https://github.com/btc-vision/opnet/pull/146)) by @BlobMaster41
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
## [v1.8.3] - 2026-03-09
|
|
4
17
|
|
|
5
18
|
### Features
|
|
@@ -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
|
@@ -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)));
|
|
@@ -2695,16 +2693,14 @@ var AbstractRpcProvider = class {
|
|
|
2695
2693
|
* Get block witnesses.
|
|
2696
2694
|
* @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
2695
|
* @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
2696
|
* @param {number} [limit] The maximum number of witnesses to return
|
|
2700
2697
|
* @param {number} [page] The page number of the witnesses
|
|
2701
2698
|
* @returns {Promise<BlockWitnesses>} The witnesses of the block
|
|
2702
2699
|
* @example await getBlockWitness(123456n);
|
|
2703
2700
|
* @throws {Error} If something went wrong while fetching the witnesses
|
|
2704
2701
|
*/
|
|
2705
|
-
async getBlockWitness(height = -1,
|
|
2702
|
+
async getBlockWitness(height = -1, limit, page) {
|
|
2706
2703
|
const params = [height.toString()];
|
|
2707
|
-
if (trusted !== void 0 && trusted !== null) params.push(trusted);
|
|
2708
2704
|
if (limit !== void 0 && limit !== null) params.push(limit);
|
|
2709
2705
|
if (page !== void 0 && page !== null) params.push(page);
|
|
2710
2706
|
const payload = this.buildJsonRpcPayload(JSONRpcMethods.BLOCK_WITNESS, params);
|
|
@@ -4472,8 +4468,7 @@ var WebSocketRpcProvider = class extends AbstractRpcProvider {
|
|
|
4472
4468
|
case JSONRpcMethods.BLOCK_WITNESS: return {
|
|
4473
4469
|
2: Long.fromString(String(params[0] ?? -1)),
|
|
4474
4470
|
3: params[1],
|
|
4475
|
-
4: params[2]
|
|
4476
|
-
5: params[3]
|
|
4471
|
+
4: params[2]
|
|
4477
4472
|
};
|
|
4478
4473
|
case JSONRpcMethods.GAS: return {};
|
|
4479
4474
|
case JSONRpcMethods.GET_TRANSACTION_BY_HASH: return { 2: params[0] };
|
|
@@ -8863,7 +8858,7 @@ var OP721Events = [
|
|
|
8863
8858
|
type: ABIDataTypes.ADDRESS
|
|
8864
8859
|
},
|
|
8865
8860
|
{
|
|
8866
|
-
name: "
|
|
8861
|
+
name: "tokenId",
|
|
8867
8862
|
type: ABIDataTypes.UINT256
|
|
8868
8863
|
}
|
|
8869
8864
|
],
|
|
@@ -8877,11 +8872,11 @@ var OP721Events = [
|
|
|
8877
8872
|
type: ABIDataTypes.ADDRESS
|
|
8878
8873
|
},
|
|
8879
8874
|
{
|
|
8880
|
-
name: "
|
|
8875
|
+
name: "operator",
|
|
8881
8876
|
type: ABIDataTypes.ADDRESS
|
|
8882
8877
|
},
|
|
8883
8878
|
{
|
|
8884
|
-
name: "
|
|
8879
|
+
name: "tokenId",
|
|
8885
8880
|
type: ABIDataTypes.UINT256
|
|
8886
8881
|
}
|
|
8887
8882
|
],
|
|
@@ -8905,6 +8900,28 @@ var OP721Events = [
|
|
|
8905
8900
|
],
|
|
8906
8901
|
type: BitcoinAbiTypes.Event
|
|
8907
8902
|
},
|
|
8903
|
+
{
|
|
8904
|
+
name: "Burned",
|
|
8905
|
+
values: [{
|
|
8906
|
+
name: "from",
|
|
8907
|
+
type: ABIDataTypes.ADDRESS
|
|
8908
|
+
}, {
|
|
8909
|
+
name: "tokenId",
|
|
8910
|
+
type: ABIDataTypes.UINT256
|
|
8911
|
+
}],
|
|
8912
|
+
type: BitcoinAbiTypes.Event
|
|
8913
|
+
},
|
|
8914
|
+
{
|
|
8915
|
+
name: "Minted",
|
|
8916
|
+
values: [{
|
|
8917
|
+
name: "to",
|
|
8918
|
+
type: ABIDataTypes.ADDRESS
|
|
8919
|
+
}, {
|
|
8920
|
+
name: "tokenId",
|
|
8921
|
+
type: ABIDataTypes.UINT256
|
|
8922
|
+
}],
|
|
8923
|
+
type: BitcoinAbiTypes.Event
|
|
8924
|
+
},
|
|
8908
8925
|
{
|
|
8909
8926
|
name: "URI",
|
|
8910
8927
|
values: [{
|
|
@@ -8951,30 +8968,6 @@ var OP_721_ABI = [
|
|
|
8951
8968
|
type: ABIDataTypes.UINT256
|
|
8952
8969
|
}]
|
|
8953
8970
|
},
|
|
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
8971
|
{
|
|
8979
8972
|
name: "tokenURI",
|
|
8980
8973
|
type: BitcoinAbiTypes.Function,
|
|
@@ -9220,7 +9213,7 @@ var OP_721_ABI = [
|
|
|
9220
9213
|
}]
|
|
9221
9214
|
},
|
|
9222
9215
|
{
|
|
9223
|
-
name: "
|
|
9216
|
+
name: "nonceOf",
|
|
9224
9217
|
type: BitcoinAbiTypes.Function,
|
|
9225
9218
|
constant: true,
|
|
9226
9219
|
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>;
|
|
@@ -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)
|