opnet 1.5.16 → 1.6.0
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/browser/_version.d.ts +1 -1
- package/browser/block/BlockWitness.d.ts +23 -0
- package/browser/block/interfaces/IBlockWitness.d.ts +22 -0
- package/browser/contracts/CallResult.d.ts +3 -3
- package/browser/epoch/Epoch.d.ts +22 -0
- package/browser/epoch/EpochSubmission.d.ts +14 -0
- package/browser/epoch/EpochTemplate.d.ts +6 -0
- package/browser/epoch/SubmittedEpoch.d.ts +10 -0
- package/browser/epoch/interfaces/EpochSubmissionParams.d.ts +9 -0
- package/browser/epoch/interfaces/IEpoch.d.ts +85 -0
- package/browser/index.js +1 -1
- package/browser/opnet.d.ts +9 -1
- package/browser/providers/AbstractRpcProvider.d.ts +15 -4
- package/browser/providers/interfaces/JSONRpcMethods.d.ts +7 -2
- package/browser/utils/StringToBuffer.d.ts +1 -0
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/block/BlockWitness.d.ts +23 -0
- package/build/block/BlockWitness.js +30 -0
- package/build/block/interfaces/IBlockWitness.d.ts +22 -0
- package/build/contracts/CallResult.d.ts +3 -3
- package/build/contracts/CallResult.js +4 -4
- package/build/epoch/Epoch.d.ts +22 -0
- package/build/epoch/Epoch.js +38 -0
- package/build/epoch/EpochSubmission.d.ts +14 -0
- package/build/epoch/EpochSubmission.js +25 -0
- package/build/epoch/EpochTemplate.d.ts +6 -0
- package/build/epoch/EpochTemplate.js +9 -0
- package/build/epoch/SubmittedEpoch.d.ts +10 -0
- package/build/epoch/SubmittedEpoch.js +18 -0
- package/build/epoch/interfaces/EpochSubmissionParams.d.ts +9 -0
- package/build/epoch/interfaces/EpochSubmissionParams.js +1 -0
- package/build/epoch/interfaces/IEpoch.d.ts +85 -0
- package/build/epoch/interfaces/IEpoch.js +5 -0
- package/build/opnet.d.ts +9 -1
- package/build/opnet.js +9 -1
- package/build/providers/AbstractRpcProvider.d.ts +15 -4
- package/build/providers/AbstractRpcProvider.js +96 -20
- package/build/providers/interfaces/JSONRpcMethods.d.ts +7 -2
- package/build/providers/interfaces/JSONRpcMethods.js +6 -1
- package/build/utils/StringToBuffer.d.ts +1 -0
- package/build/utils/StringToBuffer.js +3 -0
- package/package.json +106 -106
- package/src/_version.ts +1 -1
- package/src/block/BlockWitness.ts +49 -0
- package/src/block/interfaces/IBlockWitness.ts +31 -0
- package/src/contracts/CallResult.ts +9 -15
- package/src/crypto/crypto-browser.js +6 -3
- package/src/epoch/Epoch.ts +43 -0
- package/src/epoch/EpochSubmission.ts +37 -0
- package/src/epoch/EpochTemplate.ts +12 -0
- package/src/epoch/SubmittedEpoch.ts +22 -0
- package/src/epoch/interfaces/EpochSubmissionParams.ts +10 -0
- package/src/epoch/interfaces/IEpoch.ts +99 -0
- package/src/opnet.ts +11 -1
- package/src/providers/AbstractRpcProvider.ts +230 -29
- package/src/providers/interfaces/JSONRpcMethods.ts +9 -2
- package/src/utils/StringToBuffer.ts +3 -0
- package/browser/block/interfaces/BlockWitness.d.ts +0 -11
- package/build/block/interfaces/BlockWitness.d.ts +0 -11
- package/src/block/interfaces/BlockWitness.ts +0 -14
- /package/build/block/interfaces/{BlockWitness.js → IBlockWitness.js} +0 -0
package/browser/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.6.0";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { BlockWitnesses, IBlockWitness, IBlockWitnessAPI, RawBlockWitnessAPI } from './interfaces/IBlockWitness.js';
|
|
3
|
+
export declare class BlockWitnessAPI implements IBlockWitnessAPI {
|
|
4
|
+
readonly trusted: boolean;
|
|
5
|
+
readonly signature: Buffer;
|
|
6
|
+
readonly timestamp: number;
|
|
7
|
+
readonly proofs: readonly Buffer[];
|
|
8
|
+
readonly identity?: Buffer;
|
|
9
|
+
readonly publicKey?: Address;
|
|
10
|
+
constructor(data: RawBlockWitnessAPI);
|
|
11
|
+
}
|
|
12
|
+
export declare class BlockWitness implements IBlockWitness {
|
|
13
|
+
blockNumber: bigint;
|
|
14
|
+
readonly witnesses: readonly BlockWitnessAPI[];
|
|
15
|
+
constructor(data: {
|
|
16
|
+
blockNumber: string | bigint;
|
|
17
|
+
witnesses: RawBlockWitnessAPI[];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export declare function parseBlockWitnesses(rawWitnesses: Array<{
|
|
21
|
+
blockNumber: string;
|
|
22
|
+
witnesses: RawBlockWitnessAPI[];
|
|
23
|
+
}>): BlockWitnesses;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
export interface IBlockWitnessAPI {
|
|
3
|
+
readonly trusted: boolean;
|
|
4
|
+
readonly signature: Buffer;
|
|
5
|
+
readonly timestamp: number;
|
|
6
|
+
readonly proofs: readonly Buffer[];
|
|
7
|
+
readonly identity?: Buffer;
|
|
8
|
+
readonly publicKey?: Address;
|
|
9
|
+
}
|
|
10
|
+
export interface RawBlockWitnessAPI {
|
|
11
|
+
readonly trusted: boolean;
|
|
12
|
+
readonly signature: string;
|
|
13
|
+
readonly timestamp: number;
|
|
14
|
+
readonly proofs: readonly string[];
|
|
15
|
+
readonly identity?: string;
|
|
16
|
+
readonly publicKey?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IBlockWitness {
|
|
19
|
+
blockNumber: bigint;
|
|
20
|
+
readonly witnesses: readonly IBlockWitnessAPI[];
|
|
21
|
+
}
|
|
22
|
+
export type BlockWitnesses = readonly IBlockWitness[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Network, PsbtOutputExtended, Signer } from '@btc-vision/bitcoin';
|
|
2
|
-
import { Address, BinaryReader, LoadedStorage, UTXO } from '@btc-vision/transaction';
|
|
2
|
+
import { Address, BinaryReader, LoadedStorage, RawChallenge, UTXO } from '@btc-vision/transaction';
|
|
3
3
|
import { ECPairInterface } from 'ecpair';
|
|
4
|
+
import { BitcoinFees } from '../block/BlockGasParameters.js';
|
|
4
5
|
import { AbstractRpcProvider } from '../providers/AbstractRpcProvider.js';
|
|
5
6
|
import { ContractDecodedObjectResult, DecodedOutput } from './Contract.js';
|
|
6
7
|
import { IAccessList } from './interfaces/IAccessList.js';
|
|
7
8
|
import { EventList, ICallResultData } from './interfaces/ICallResult.js';
|
|
8
9
|
import { OPNetEvent } from './OPNetEvent.js';
|
|
9
|
-
import { BitcoinFees } from '../block/BlockGasParameters.js';
|
|
10
10
|
export interface TransactionParameters {
|
|
11
11
|
readonly signer?: Signer | ECPairInterface;
|
|
12
12
|
readonly refundTo: string;
|
|
@@ -25,7 +25,7 @@ export interface InteractionTransactionReceipt {
|
|
|
25
25
|
readonly newUTXOs: UTXO[];
|
|
26
26
|
readonly peerAcknowledgements: number;
|
|
27
27
|
readonly estimatedFees: bigint;
|
|
28
|
-
readonly
|
|
28
|
+
readonly challengeSolution: RawChallenge;
|
|
29
29
|
}
|
|
30
30
|
export declare class CallResult<T extends ContractDecodedObjectResult = {}, U extends OPNetEvent<ContractDecodedObjectResult>[] = OPNetEvent<ContractDecodedObjectResult>[]> implements Omit<ICallResultData, 'estimatedGas' | 'events' | 'specialGas'> {
|
|
31
31
|
#private;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
import { IEpoch, IEpochMiner, RawEpoch, RawEpochMiner } from './interfaces/IEpoch.js';
|
|
3
|
+
export declare class EpochMiner implements IEpochMiner {
|
|
4
|
+
readonly solution: Buffer;
|
|
5
|
+
readonly publicKey: Address;
|
|
6
|
+
readonly salt: Buffer;
|
|
7
|
+
readonly graffiti?: Buffer;
|
|
8
|
+
constructor(data: RawEpochMiner);
|
|
9
|
+
}
|
|
10
|
+
export declare class Epoch implements IEpoch {
|
|
11
|
+
readonly epochNumber: bigint;
|
|
12
|
+
readonly epochHash: Buffer;
|
|
13
|
+
readonly epochRoot: Buffer;
|
|
14
|
+
readonly startBlock: bigint;
|
|
15
|
+
readonly endBlock: bigint;
|
|
16
|
+
readonly difficultyScaled: bigint;
|
|
17
|
+
readonly minDifficulty?: string;
|
|
18
|
+
readonly targetHash: Buffer;
|
|
19
|
+
readonly proposer: EpochMiner;
|
|
20
|
+
readonly proofs: readonly Buffer[];
|
|
21
|
+
constructor(data: RawEpoch);
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Epoch, EpochMiner } from './Epoch.js';
|
|
2
|
+
import { IEpochSubmission, IEpochWithSubmissions, RawEpochSubmission, RawEpochWithSubmissions } from './interfaces/IEpoch.js';
|
|
3
|
+
export declare class EpochSubmission implements IEpochSubmission {
|
|
4
|
+
readonly submissionTxId: Buffer;
|
|
5
|
+
readonly submissionTxHash: Buffer;
|
|
6
|
+
readonly submissionHash: Buffer;
|
|
7
|
+
readonly confirmedAt: string;
|
|
8
|
+
readonly epochProposed: EpochMiner;
|
|
9
|
+
constructor(data: RawEpochSubmission);
|
|
10
|
+
}
|
|
11
|
+
export declare class EpochWithSubmissions extends Epoch implements IEpochWithSubmissions {
|
|
12
|
+
readonly submissions?: readonly EpochSubmission[];
|
|
13
|
+
constructor(data: RawEpochWithSubmissions);
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISubmittedEpoch, RawSubmittedEpoch, SubmissionStatus } from './interfaces/IEpoch.js';
|
|
2
|
+
export declare class SubmittedEpoch implements ISubmittedEpoch {
|
|
3
|
+
readonly epochNumber: bigint;
|
|
4
|
+
readonly submissionHash: Buffer;
|
|
5
|
+
readonly difficulty: number;
|
|
6
|
+
readonly timestamp: Date;
|
|
7
|
+
readonly status: SubmissionStatus;
|
|
8
|
+
readonly message?: string;
|
|
9
|
+
constructor(data: RawSubmittedEpoch);
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
export interface EpochSubmissionParams {
|
|
3
|
+
readonly epochNumber: bigint;
|
|
4
|
+
readonly targetHash: Buffer;
|
|
5
|
+
readonly salt: Buffer;
|
|
6
|
+
readonly publicKey: Address;
|
|
7
|
+
readonly signature: Buffer;
|
|
8
|
+
readonly graffiti?: Buffer;
|
|
9
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Address } from '@btc-vision/transaction';
|
|
2
|
+
export interface IEpochMiner {
|
|
3
|
+
readonly solution: Buffer;
|
|
4
|
+
readonly publicKey: Address;
|
|
5
|
+
readonly salt: Buffer;
|
|
6
|
+
readonly graffiti?: Buffer;
|
|
7
|
+
}
|
|
8
|
+
export interface IEpoch {
|
|
9
|
+
readonly epochNumber: bigint;
|
|
10
|
+
readonly epochHash: Buffer;
|
|
11
|
+
readonly epochRoot: Buffer;
|
|
12
|
+
readonly startBlock: bigint;
|
|
13
|
+
readonly endBlock: bigint;
|
|
14
|
+
readonly difficultyScaled: bigint;
|
|
15
|
+
readonly minDifficulty?: string;
|
|
16
|
+
readonly targetHash: Buffer;
|
|
17
|
+
readonly proposer: IEpochMiner;
|
|
18
|
+
readonly proofs: readonly Buffer[];
|
|
19
|
+
}
|
|
20
|
+
export interface RawEpochMiner {
|
|
21
|
+
readonly solution: string;
|
|
22
|
+
readonly publicKey: string;
|
|
23
|
+
readonly salt: string;
|
|
24
|
+
readonly graffiti?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RawEpoch {
|
|
27
|
+
readonly epochNumber: string;
|
|
28
|
+
readonly epochHash: string;
|
|
29
|
+
readonly epochRoot: string;
|
|
30
|
+
readonly startBlock: string;
|
|
31
|
+
readonly endBlock: string;
|
|
32
|
+
readonly difficultyScaled: string;
|
|
33
|
+
readonly minDifficulty?: string;
|
|
34
|
+
readonly targetHash: string;
|
|
35
|
+
readonly proposer: RawEpochMiner;
|
|
36
|
+
readonly proofs: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
export interface RawEpochSubmission {
|
|
39
|
+
readonly submissionTxId: string;
|
|
40
|
+
readonly submissionTxHash: string;
|
|
41
|
+
readonly submissionHash: string;
|
|
42
|
+
readonly confirmedAt: string;
|
|
43
|
+
readonly epochProposed: RawEpochMiner;
|
|
44
|
+
}
|
|
45
|
+
export interface IEpochSubmission {
|
|
46
|
+
readonly submissionTxId: Buffer;
|
|
47
|
+
readonly submissionTxHash: Buffer;
|
|
48
|
+
readonly submissionHash: Buffer;
|
|
49
|
+
readonly confirmedAt: string;
|
|
50
|
+
readonly epochProposed: IEpochMiner;
|
|
51
|
+
}
|
|
52
|
+
export interface IEpochWithSubmissions extends IEpoch {
|
|
53
|
+
readonly submissions?: readonly IEpochSubmission[];
|
|
54
|
+
}
|
|
55
|
+
export interface RawEpochWithSubmissions extends RawEpoch {
|
|
56
|
+
readonly submissions?: readonly RawEpochSubmission[];
|
|
57
|
+
}
|
|
58
|
+
export interface RawEpochTemplate {
|
|
59
|
+
readonly epochNumber: string;
|
|
60
|
+
readonly epochTarget: string;
|
|
61
|
+
}
|
|
62
|
+
export interface IEpochTemplate {
|
|
63
|
+
readonly epochNumber: bigint;
|
|
64
|
+
readonly epochTarget: Buffer;
|
|
65
|
+
}
|
|
66
|
+
export declare enum SubmissionStatus {
|
|
67
|
+
ACCEPTED = "accepted",
|
|
68
|
+
REJECTED = "rejected"
|
|
69
|
+
}
|
|
70
|
+
export interface RawSubmittedEpoch {
|
|
71
|
+
readonly epochNumber: string;
|
|
72
|
+
readonly submissionHash: string;
|
|
73
|
+
readonly difficulty: number;
|
|
74
|
+
readonly timestamp: number | Date;
|
|
75
|
+
readonly status: SubmissionStatus;
|
|
76
|
+
readonly message?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ISubmittedEpoch {
|
|
79
|
+
readonly epochNumber: bigint;
|
|
80
|
+
readonly submissionHash: Buffer;
|
|
81
|
+
readonly difficulty: number;
|
|
82
|
+
readonly timestamp: Date;
|
|
83
|
+
readonly status: SubmissionStatus;
|
|
84
|
+
readonly message?: string;
|
|
85
|
+
}
|