@jibidieuw/dexes 0.0.2 → 0.1.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/dist/index.d.mts +187 -260
- package/dist/index.d.ts +187 -260
- package/dist/index.js +231 -171
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, TransactionReceipt, PublicClient, WalletClient, BlockTag } from 'viem';
|
|
1
|
+
import { Address, TransactionReceipt, PublicClient, Transport, Chain, WalletClient, BlockTag } from 'viem';
|
|
2
2
|
import * as openpgp from 'openpgp';
|
|
3
3
|
|
|
4
4
|
declare class InvalidHexError extends Error {
|
|
@@ -141,7 +141,7 @@ declare class FlatFee implements IFlatFee {
|
|
|
141
141
|
* @param client A Viem public client for interacting with the blockchain.
|
|
142
142
|
* @param walletClient Optional Viem wallet client for signing transactions.
|
|
143
143
|
*/
|
|
144
|
-
constructor(address: Address, client: PublicClient, walletClient?: WalletClient);
|
|
144
|
+
constructor(address: Address, client: PublicClient<Transport, Chain | undefined>, walletClient?: WalletClient);
|
|
145
145
|
/*****************************************************************************************************************/
|
|
146
146
|
/*****************************************************************************************************************/
|
|
147
147
|
/**
|
|
@@ -159,7 +159,7 @@ declare class FlatFee implements IFlatFee {
|
|
|
159
159
|
/**
|
|
160
160
|
* Sets the Viem public client.
|
|
161
161
|
*/
|
|
162
|
-
set client(client: PublicClient);
|
|
162
|
+
set client(client: PublicClient<Transport, Chain | undefined>);
|
|
163
163
|
/**
|
|
164
164
|
* Gets the Viem wallet client.
|
|
165
165
|
*/
|
|
@@ -1980,7 +1980,7 @@ declare class Web3PGP extends FlatFee implements IWeb3PGP {
|
|
|
1980
1980
|
private static readonly OWNERSHIP_PROVED_EVENT;
|
|
1981
1981
|
private static readonly KEY_CERTIFIED_EVENT;
|
|
1982
1982
|
private static readonly KEY_CERTIFICATION_REVOKED_EVENT;
|
|
1983
|
-
constructor(address: `0x${string}`, client: PublicClient, walletClient?: WalletClient);
|
|
1983
|
+
constructor(address: `0x${string}`, client: PublicClient<Transport, Chain | undefined>, walletClient?: WalletClient);
|
|
1984
1984
|
/*****************************************************************************************************************/
|
|
1985
1985
|
/*****************************************************************************************************************/
|
|
1986
1986
|
/**
|
|
@@ -2300,8 +2300,8 @@ declare class Web3PGPServiceError extends Error {
|
|
|
2300
2300
|
* This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.
|
|
2301
2301
|
*/
|
|
2302
2302
|
declare class Web3PGPServiceCriticalError extends Web3PGPServiceError {
|
|
2303
|
-
readonly cause?: Error
|
|
2304
|
-
constructor(message: string, cause?: Error
|
|
2303
|
+
readonly cause?: Error;
|
|
2304
|
+
constructor(message: string, cause?: Error);
|
|
2305
2305
|
}
|
|
2306
2306
|
/**
|
|
2307
2307
|
* Error thrown when key or blockchain data validation fails.
|
|
@@ -2747,42 +2747,42 @@ declare class Web3PGPService implements IWeb3PGPService {
|
|
|
2747
2747
|
*/
|
|
2748
2748
|
extractFromKeyRevokedLog(log: KeyRevokedLog, skipCryptographicVerifications?: boolean): Promise<[openpgp.PublicKey | undefined, string | undefined]>;
|
|
2749
2749
|
/**
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2750
|
+
* Validate and extract the updated public key from a KeyUpdatedLog event.
|
|
2751
|
+
*
|
|
2752
|
+
* @description
|
|
2753
|
+
* This method:
|
|
2754
|
+
* 1. Validates the log data contains required fields
|
|
2755
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2756
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2757
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2758
|
+
* revoked at the time of update (uses the block timestamp).
|
|
2759
|
+
*
|
|
2760
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
2761
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2762
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2763
|
+
* OpenPGP toolkit.
|
|
2764
|
+
*
|
|
2765
|
+
* @param log The KeyUpdatedLog event data from the blockchain
|
|
2766
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
2767
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
2768
|
+
*
|
|
2769
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2770
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2771
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2772
|
+
*
|
|
2773
|
+
* @example
|
|
2774
|
+
* ```typescript
|
|
2775
|
+
* const logs = await web3pgp.searchKeyUpdatedLogs();
|
|
2776
|
+
* for (const log of logs) {
|
|
2777
|
+
* try {
|
|
2778
|
+
* const publicKey = await service.extractFromKeyUpdatedLog(log);
|
|
2779
|
+
* console.log(`Valid updated key: ${publicKey.getFingerprint()}`);
|
|
2780
|
+
* } catch (err) {
|
|
2781
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
2782
|
+
* }
|
|
2783
|
+
* }
|
|
2784
|
+
* ```
|
|
2785
|
+
*/
|
|
2786
2786
|
extractFromKeyUpdatedLog(log: KeyUpdatedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2787
2787
|
/**
|
|
2788
2788
|
* Validate and extract the certified public key from a KeyCertifiedLog event.
|
|
@@ -2940,9 +2940,9 @@ declare enum EventType {
|
|
|
2940
2940
|
COPY = 1
|
|
2941
2941
|
}
|
|
2942
2942
|
/**
|
|
2943
|
-
* Constants representing the different event types emitted by the
|
|
2943
|
+
* Constants representing the different event types emitted by the Web3Sign smart contract.
|
|
2944
2944
|
*/
|
|
2945
|
-
declare const
|
|
2945
|
+
declare const Web3SignEvents: {
|
|
2946
2946
|
readonly Document: "Document";
|
|
2947
2947
|
readonly Copy: "Copy";
|
|
2948
2948
|
readonly Notification: "Notification";
|
|
@@ -2962,7 +2962,7 @@ declare const Web3DocEvents: {
|
|
|
2962
2962
|
* @property mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
2963
2963
|
*/
|
|
2964
2964
|
type DocumentLog = BaseLog & {
|
|
2965
|
-
type: typeof
|
|
2965
|
+
type: typeof Web3SignEvents.Document;
|
|
2966
2966
|
id: bigint;
|
|
2967
2967
|
emitter: `0x${string}`;
|
|
2968
2968
|
dochash: `0x${string}`;
|
|
@@ -2981,7 +2981,7 @@ type DocumentLog = BaseLog & {
|
|
|
2981
2981
|
* @property uri The URI which can be used to download the binary OpenPGP message containing the document from an off-chain storage.
|
|
2982
2982
|
*/
|
|
2983
2983
|
type CopyLog = BaseLog & {
|
|
2984
|
-
type: typeof
|
|
2984
|
+
type: typeof Web3SignEvents.Copy;
|
|
2985
2985
|
copy: bigint;
|
|
2986
2986
|
original: bigint;
|
|
2987
2987
|
emitter: `0x${string}`;
|
|
@@ -2998,7 +2998,7 @@ type CopyLog = BaseLog & {
|
|
|
2998
2998
|
* @property signatureRequested If true, the recipient is prompted by the emitter to sign the document.
|
|
2999
2999
|
*/
|
|
3000
3000
|
type NotificationLog = BaseLog & {
|
|
3001
|
-
type: typeof
|
|
3001
|
+
type: typeof Web3SignEvents.Notification;
|
|
3002
3002
|
id: bigint;
|
|
3003
3003
|
emitter: `0x${string}`;
|
|
3004
3004
|
recipient: `0x${string}`;
|
|
@@ -3014,7 +3014,7 @@ type NotificationLog = BaseLog & {
|
|
|
3014
3014
|
* @property signature The binary OpenPGP message which contains the detached signature over the document.
|
|
3015
3015
|
*/
|
|
3016
3016
|
type SignatureLog = BaseLog & {
|
|
3017
|
-
type: typeof
|
|
3017
|
+
type: typeof Web3SignEvents.Signature;
|
|
3018
3018
|
id: bigint;
|
|
3019
3019
|
emitter: `0x${string}`;
|
|
3020
3020
|
signatureHash: `0x${string}`;
|
|
@@ -3029,7 +3029,7 @@ type SignatureLog = BaseLog & {
|
|
|
3029
3029
|
* @property signature A detached binary OpenPGP signature created over the signature hash.
|
|
3030
3030
|
*/
|
|
3031
3031
|
type SignatureRevocationLog = BaseLog & {
|
|
3032
|
-
type: typeof
|
|
3032
|
+
type: typeof Web3SignEvents.SignatureRevocation;
|
|
3033
3033
|
id: bigint;
|
|
3034
3034
|
emitter: `0x${string}`;
|
|
3035
3035
|
signatureHash: `0x${string}`;
|
|
@@ -3044,7 +3044,7 @@ type SignatureRevocationLog = BaseLog & {
|
|
|
3044
3044
|
* @property signature A detached binary OpenPGP signature created over the keccak256 hash of the document.
|
|
3045
3045
|
*/
|
|
3046
3046
|
type TimestampLog = BaseLog & {
|
|
3047
|
-
type: typeof
|
|
3047
|
+
type: typeof Web3SignEvents.Timestamp;
|
|
3048
3048
|
id: bigint;
|
|
3049
3049
|
emitter: `0x${string}`;
|
|
3050
3050
|
dochash: `0x${string}`;
|
|
@@ -3052,11 +3052,11 @@ type TimestampLog = BaseLog & {
|
|
|
3052
3052
|
};
|
|
3053
3053
|
|
|
3054
3054
|
/**
|
|
3055
|
-
* TypeScript interface for the
|
|
3055
|
+
* TypeScript interface for the Web3Sign smart contract.
|
|
3056
3056
|
*
|
|
3057
|
-
* This interface provides low-level bindings to interact with the
|
|
3057
|
+
* This interface provides low-level bindings to interact with the Web3Sign contract deployed on the blockchain.
|
|
3058
3058
|
*/
|
|
3059
|
-
interface
|
|
3059
|
+
interface IWeb3Sign extends IFlatFee {
|
|
3060
3060
|
/*****************************************************************************************************************/
|
|
3061
3061
|
/*****************************************************************************************************************/
|
|
3062
3062
|
/**
|
|
@@ -3377,17 +3377,17 @@ interface IWeb3Doc extends IFlatFee {
|
|
|
3377
3377
|
}
|
|
3378
3378
|
|
|
3379
3379
|
/**
|
|
3380
|
-
* Interface representing the
|
|
3380
|
+
* Interface representing the Web3Sign service for managing documents on the blockchain.
|
|
3381
3381
|
*
|
|
3382
3382
|
* Higher order bindings are provided and involve OpenPGP operations in order to ease the overall developer experience.
|
|
3383
3383
|
*
|
|
3384
3384
|
* @todo Add methods for document exchange (sendDocument, sendCopy, notifyRecipients, ...)
|
|
3385
3385
|
*/
|
|
3386
|
-
interface
|
|
3386
|
+
interface IWeb3SignService {
|
|
3387
3387
|
/*****************************************************************************************************************/
|
|
3388
3388
|
/*****************************************************************************************************************/
|
|
3389
3389
|
/**
|
|
3390
|
-
* This function allows submitting the data needed to timestamp a document to the
|
|
3390
|
+
* This function allows submitting the data needed to timestamp a document to the Web3Sign smart contract.
|
|
3391
3391
|
*
|
|
3392
3392
|
* The function will download and verify the emitter's public key using the Web3PGP contract and then it will verify
|
|
3393
3393
|
* the provided detached signature over the keccak256 hash of the document. If the signature is valid, it will submit
|
|
@@ -3404,7 +3404,7 @@ interface IWeb3DocService {
|
|
|
3404
3404
|
timestamp(hash: Uint8Array, signature: openpgp.Signature, emitter: `0x${string}`): Promise<[bigint, TransactionReceipt]>;
|
|
3405
3405
|
/**
|
|
3406
3406
|
* Verifies a timestamp entry on the blockchain by its ID. The function retrieves the timestamp data from the
|
|
3407
|
-
*
|
|
3407
|
+
* Web3Sign smart contract and verifies the detached signature over the document hash using the emitter's public key.
|
|
3408
3408
|
*
|
|
3409
3409
|
* The function returns the document hash, the signature, and the public key used for verification.
|
|
3410
3410
|
*
|
|
@@ -3432,12 +3432,12 @@ interface IWeb3DocService {
|
|
|
3432
3432
|
}
|
|
3433
3433
|
|
|
3434
3434
|
/**
|
|
3435
|
-
* Implementation of the
|
|
3435
|
+
* Implementation of the Web3Sign contract interface.
|
|
3436
3436
|
*
|
|
3437
|
-
* This class provides low-level bindings to interact with the
|
|
3437
|
+
* This class provides low-level bindings to interact with the Web3Sign contract deployed on the blockchain.
|
|
3438
3438
|
* Extends FlatFee to inherit fee management and access control functionality.
|
|
3439
3439
|
*/
|
|
3440
|
-
declare class
|
|
3440
|
+
declare class Web3Sign extends FlatFee implements IWeb3Sign {
|
|
3441
3441
|
static readonly abi: readonly [{
|
|
3442
3442
|
readonly type: "constructor";
|
|
3443
3443
|
readonly inputs: readonly [];
|
|
@@ -3445,6 +3445,9 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3445
3445
|
}, {
|
|
3446
3446
|
readonly type: "receive";
|
|
3447
3447
|
readonly stateMutability: "payable";
|
|
3448
|
+
}, {
|
|
3449
|
+
readonly type: "fallback";
|
|
3450
|
+
readonly stateMutability: "payable";
|
|
3448
3451
|
}, {
|
|
3449
3452
|
readonly type: "function";
|
|
3450
3453
|
readonly name: "UPGRADE_INTERFACE_VERSION";
|
|
@@ -3479,7 +3482,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3479
3482
|
}, {
|
|
3480
3483
|
readonly name: "recipients";
|
|
3481
3484
|
readonly type: "tuple[]";
|
|
3482
|
-
readonly internalType: "struct
|
|
3485
|
+
readonly internalType: "struct IWeb3Sign.Recipient[]";
|
|
3483
3486
|
readonly components: readonly [{
|
|
3484
3487
|
readonly name: "fingerprint";
|
|
3485
3488
|
readonly type: "bytes32";
|
|
@@ -3510,7 +3513,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3510
3513
|
}, {
|
|
3511
3514
|
readonly name: "recipients";
|
|
3512
3515
|
readonly type: "tuple[]";
|
|
3513
|
-
readonly internalType: "struct
|
|
3516
|
+
readonly internalType: "struct IWeb3Sign.Recipient[]";
|
|
3514
3517
|
readonly components: readonly [{
|
|
3515
3518
|
readonly name: "fingerprint";
|
|
3516
3519
|
readonly type: "bytes32";
|
|
@@ -3555,6 +3558,16 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3555
3558
|
readonly internalType: "uint256[]";
|
|
3556
3559
|
}];
|
|
3557
3560
|
readonly stateMutability: "view";
|
|
3561
|
+
}, {
|
|
3562
|
+
readonly type: "function";
|
|
3563
|
+
readonly name: "getRequestedFee";
|
|
3564
|
+
readonly inputs: readonly [];
|
|
3565
|
+
readonly outputs: readonly [{
|
|
3566
|
+
readonly name: "";
|
|
3567
|
+
readonly type: "uint256";
|
|
3568
|
+
readonly internalType: "uint256";
|
|
3569
|
+
}];
|
|
3570
|
+
readonly stateMutability: "view";
|
|
3558
3571
|
}, {
|
|
3559
3572
|
readonly type: "function";
|
|
3560
3573
|
readonly name: "getSignatureBlockNumberByHash";
|
|
@@ -3617,16 +3630,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3617
3630
|
readonly inputs: readonly [];
|
|
3618
3631
|
readonly outputs: readonly [];
|
|
3619
3632
|
readonly stateMutability: "nonpayable";
|
|
3620
|
-
}, {
|
|
3621
|
-
readonly type: "function";
|
|
3622
|
-
readonly name: "isConsumingScheduledOp";
|
|
3623
|
-
readonly inputs: readonly [];
|
|
3624
|
-
readonly outputs: readonly [{
|
|
3625
|
-
readonly name: "";
|
|
3626
|
-
readonly type: "bytes4";
|
|
3627
|
-
readonly internalType: "bytes4";
|
|
3628
|
-
}];
|
|
3629
|
-
readonly stateMutability: "view";
|
|
3630
3633
|
}, {
|
|
3631
3634
|
readonly type: "function";
|
|
3632
3635
|
readonly name: "isCopyOf";
|
|
@@ -3717,16 +3720,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3717
3720
|
readonly internalType: "bytes32";
|
|
3718
3721
|
}];
|
|
3719
3722
|
readonly stateMutability: "view";
|
|
3720
|
-
}, {
|
|
3721
|
-
readonly type: "function";
|
|
3722
|
-
readonly name: "requestedFee";
|
|
3723
|
-
readonly inputs: readonly [];
|
|
3724
|
-
readonly outputs: readonly [{
|
|
3725
|
-
readonly name: "";
|
|
3726
|
-
readonly type: "uint256";
|
|
3727
|
-
readonly internalType: "uint256";
|
|
3728
|
-
}];
|
|
3729
|
-
readonly stateMutability: "view";
|
|
3730
3723
|
}, {
|
|
3731
3724
|
readonly type: "function";
|
|
3732
3725
|
readonly name: "revokeSignature";
|
|
@@ -3749,6 +3742,16 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3749
3742
|
}];
|
|
3750
3743
|
readonly outputs: readonly [];
|
|
3751
3744
|
readonly stateMutability: "payable";
|
|
3745
|
+
}, {
|
|
3746
|
+
readonly type: "function";
|
|
3747
|
+
readonly name: "setAuthority";
|
|
3748
|
+
readonly inputs: readonly [{
|
|
3749
|
+
readonly name: "newAuthority";
|
|
3750
|
+
readonly type: "address";
|
|
3751
|
+
readonly internalType: "address";
|
|
3752
|
+
}];
|
|
3753
|
+
readonly outputs: readonly [];
|
|
3754
|
+
readonly stateMutability: "nonpayable";
|
|
3752
3755
|
}, {
|
|
3753
3756
|
readonly type: "function";
|
|
3754
3757
|
readonly name: "sendOffChain";
|
|
@@ -3759,7 +3762,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3759
3762
|
}, {
|
|
3760
3763
|
readonly name: "recipients";
|
|
3761
3764
|
readonly type: "tuple[]";
|
|
3762
|
-
readonly internalType: "struct
|
|
3765
|
+
readonly internalType: "struct IWeb3Sign.Recipient[]";
|
|
3763
3766
|
readonly components: readonly [{
|
|
3764
3767
|
readonly name: "fingerprint";
|
|
3765
3768
|
readonly type: "bytes32";
|
|
@@ -3798,7 +3801,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3798
3801
|
}, {
|
|
3799
3802
|
readonly name: "recipients";
|
|
3800
3803
|
readonly type: "tuple[]";
|
|
3801
|
-
readonly internalType: "struct
|
|
3804
|
+
readonly internalType: "struct IWeb3Sign.Recipient[]";
|
|
3802
3805
|
readonly components: readonly [{
|
|
3803
3806
|
readonly name: "fingerprint";
|
|
3804
3807
|
readonly type: "bytes32";
|
|
@@ -3827,16 +3830,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3827
3830
|
}];
|
|
3828
3831
|
readonly outputs: readonly [];
|
|
3829
3832
|
readonly stateMutability: "payable";
|
|
3830
|
-
}, {
|
|
3831
|
-
readonly type: "function";
|
|
3832
|
-
readonly name: "setAuthority";
|
|
3833
|
-
readonly inputs: readonly [{
|
|
3834
|
-
readonly name: "newAuthority";
|
|
3835
|
-
readonly type: "address";
|
|
3836
|
-
readonly internalType: "address";
|
|
3837
|
-
}];
|
|
3838
|
-
readonly outputs: readonly [];
|
|
3839
|
-
readonly stateMutability: "nonpayable";
|
|
3840
3833
|
}, {
|
|
3841
3834
|
readonly type: "function";
|
|
3842
3835
|
readonly name: "sign";
|
|
@@ -3873,16 +3866,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3873
3866
|
}];
|
|
3874
3867
|
readonly outputs: readonly [];
|
|
3875
3868
|
readonly stateMutability: "payable";
|
|
3876
|
-
}, {
|
|
3877
|
-
readonly type: "function";
|
|
3878
|
-
readonly name: "updateRequestedFee";
|
|
3879
|
-
readonly inputs: readonly [{
|
|
3880
|
-
readonly name: "newFee";
|
|
3881
|
-
readonly type: "uint256";
|
|
3882
|
-
readonly internalType: "uint256";
|
|
3883
|
-
}];
|
|
3884
|
-
readonly outputs: readonly [];
|
|
3885
|
-
readonly stateMutability: "nonpayable";
|
|
3886
3869
|
}, {
|
|
3887
3870
|
readonly type: "function";
|
|
3888
3871
|
readonly name: "upgradeToAndCall";
|
|
@@ -3897,16 +3880,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3897
3880
|
}];
|
|
3898
3881
|
readonly outputs: readonly [];
|
|
3899
3882
|
readonly stateMutability: "payable";
|
|
3900
|
-
}, {
|
|
3901
|
-
readonly type: "function";
|
|
3902
|
-
readonly name: "withdrawFees";
|
|
3903
|
-
readonly inputs: readonly [{
|
|
3904
|
-
readonly name: "to";
|
|
3905
|
-
readonly type: "address";
|
|
3906
|
-
readonly internalType: "address";
|
|
3907
|
-
}];
|
|
3908
|
-
readonly outputs: readonly [];
|
|
3909
|
-
readonly stateMutability: "nonpayable";
|
|
3910
3883
|
}, {
|
|
3911
3884
|
readonly type: "event";
|
|
3912
3885
|
readonly name: "AuthorityUpdated";
|
|
@@ -3987,21 +3960,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
3987
3960
|
readonly internalType: "string";
|
|
3988
3961
|
}];
|
|
3989
3962
|
readonly anonymous: false;
|
|
3990
|
-
}, {
|
|
3991
|
-
readonly type: "event";
|
|
3992
|
-
readonly name: "FeesWithdrawn";
|
|
3993
|
-
readonly inputs: readonly [{
|
|
3994
|
-
readonly name: "to";
|
|
3995
|
-
readonly type: "address";
|
|
3996
|
-
readonly indexed: true;
|
|
3997
|
-
readonly internalType: "address";
|
|
3998
|
-
}, {
|
|
3999
|
-
readonly name: "amount";
|
|
4000
|
-
readonly type: "uint256";
|
|
4001
|
-
readonly indexed: false;
|
|
4002
|
-
readonly internalType: "uint256";
|
|
4003
|
-
}];
|
|
4004
|
-
readonly anonymous: false;
|
|
4005
3963
|
}, {
|
|
4006
3964
|
readonly type: "event";
|
|
4007
3965
|
readonly name: "Initialized";
|
|
@@ -4034,7 +3992,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4034
3992
|
readonly name: "source";
|
|
4035
3993
|
readonly type: "uint8";
|
|
4036
3994
|
readonly indexed: false;
|
|
4037
|
-
readonly internalType: "enum
|
|
3995
|
+
readonly internalType: "enum IWeb3Sign.EventType";
|
|
4038
3996
|
}, {
|
|
4039
3997
|
readonly name: "signatureRequested";
|
|
4040
3998
|
readonly type: "bool";
|
|
@@ -4142,42 +4100,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4142
4100
|
readonly internalType: "address";
|
|
4143
4101
|
}];
|
|
4144
4102
|
readonly anonymous: false;
|
|
4145
|
-
}, {
|
|
4146
|
-
readonly type: "error";
|
|
4147
|
-
readonly name: "AccessManagedInvalidAuthority";
|
|
4148
|
-
readonly inputs: readonly [{
|
|
4149
|
-
readonly name: "authority";
|
|
4150
|
-
readonly type: "address";
|
|
4151
|
-
readonly internalType: "address";
|
|
4152
|
-
}];
|
|
4153
|
-
}, {
|
|
4154
|
-
readonly type: "error";
|
|
4155
|
-
readonly name: "AccessManagedRequiredDelay";
|
|
4156
|
-
readonly inputs: readonly [{
|
|
4157
|
-
readonly name: "caller";
|
|
4158
|
-
readonly type: "address";
|
|
4159
|
-
readonly internalType: "address";
|
|
4160
|
-
}, {
|
|
4161
|
-
readonly name: "delay";
|
|
4162
|
-
readonly type: "uint32";
|
|
4163
|
-
readonly internalType: "uint32";
|
|
4164
|
-
}];
|
|
4165
|
-
}, {
|
|
4166
|
-
readonly type: "error";
|
|
4167
|
-
readonly name: "AccessManagedUnauthorized";
|
|
4168
|
-
readonly inputs: readonly [{
|
|
4169
|
-
readonly name: "caller";
|
|
4170
|
-
readonly type: "address";
|
|
4171
|
-
readonly internalType: "address";
|
|
4172
|
-
}];
|
|
4173
|
-
}, {
|
|
4174
|
-
readonly type: "error";
|
|
4175
|
-
readonly name: "AddressEmptyCode";
|
|
4176
|
-
readonly inputs: readonly [{
|
|
4177
|
-
readonly name: "target";
|
|
4178
|
-
readonly type: "address";
|
|
4179
|
-
readonly internalType: "address";
|
|
4180
|
-
}];
|
|
4181
4103
|
}, {
|
|
4182
4104
|
readonly type: "error";
|
|
4183
4105
|
readonly name: "DocumentIsACopy";
|
|
@@ -4194,18 +4116,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4194
4116
|
readonly type: "uint256";
|
|
4195
4117
|
readonly internalType: "uint256";
|
|
4196
4118
|
}];
|
|
4197
|
-
}, {
|
|
4198
|
-
readonly type: "error";
|
|
4199
|
-
readonly name: "ERC1967InvalidImplementation";
|
|
4200
|
-
readonly inputs: readonly [{
|
|
4201
|
-
readonly name: "implementation";
|
|
4202
|
-
readonly type: "address";
|
|
4203
|
-
readonly internalType: "address";
|
|
4204
|
-
}];
|
|
4205
|
-
}, {
|
|
4206
|
-
readonly type: "error";
|
|
4207
|
-
readonly name: "ERC1967NonPayable";
|
|
4208
|
-
readonly inputs: readonly [];
|
|
4209
4119
|
}, {
|
|
4210
4120
|
readonly type: "error";
|
|
4211
4121
|
readonly name: "EmitterNotFound";
|
|
@@ -4216,23 +4126,7 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4216
4126
|
}];
|
|
4217
4127
|
}, {
|
|
4218
4128
|
readonly type: "error";
|
|
4219
|
-
readonly name: "
|
|
4220
|
-
readonly inputs: readonly [];
|
|
4221
|
-
}, {
|
|
4222
|
-
readonly type: "error";
|
|
4223
|
-
readonly name: "FeeRequired";
|
|
4224
|
-
readonly inputs: readonly [{
|
|
4225
|
-
readonly name: "provided";
|
|
4226
|
-
readonly type: "uint256";
|
|
4227
|
-
readonly internalType: "uint256";
|
|
4228
|
-
}, {
|
|
4229
|
-
readonly name: "required";
|
|
4230
|
-
readonly type: "uint256";
|
|
4231
|
-
readonly internalType: "uint256";
|
|
4232
|
-
}];
|
|
4233
|
-
}, {
|
|
4234
|
-
readonly type: "error";
|
|
4235
|
-
readonly name: "FeesWithdrawalFailed";
|
|
4129
|
+
readonly name: "EnforcedPause";
|
|
4236
4130
|
readonly inputs: readonly [];
|
|
4237
4131
|
}, {
|
|
4238
4132
|
readonly type: "error";
|
|
@@ -4240,16 +4134,16 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4240
4134
|
readonly inputs: readonly [];
|
|
4241
4135
|
}, {
|
|
4242
4136
|
readonly type: "error";
|
|
4243
|
-
readonly name: "
|
|
4244
|
-
readonly inputs: readonly [];
|
|
4245
|
-
}, {
|
|
4246
|
-
readonly type: "error";
|
|
4247
|
-
readonly name: "NoFeesToWithdraw";
|
|
4137
|
+
readonly name: "NotInitializing";
|
|
4248
4138
|
readonly inputs: readonly [];
|
|
4249
4139
|
}, {
|
|
4250
4140
|
readonly type: "error";
|
|
4251
|
-
readonly name: "
|
|
4252
|
-
readonly inputs: readonly [
|
|
4141
|
+
readonly name: "NotAuthorized";
|
|
4142
|
+
readonly inputs: readonly [{
|
|
4143
|
+
readonly name: "caller";
|
|
4144
|
+
readonly type: "address";
|
|
4145
|
+
readonly internalType: "address";
|
|
4146
|
+
}];
|
|
4253
4147
|
}, {
|
|
4254
4148
|
readonly type: "error";
|
|
4255
4149
|
readonly name: "RecipientNotFound";
|
|
@@ -4258,10 +4152,6 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4258
4152
|
readonly type: "bytes32";
|
|
4259
4153
|
readonly internalType: "bytes32";
|
|
4260
4154
|
}];
|
|
4261
|
-
}, {
|
|
4262
|
-
readonly type: "error";
|
|
4263
|
-
readonly name: "ReentrancyGuardReentrantCall";
|
|
4264
|
-
readonly inputs: readonly [];
|
|
4265
4155
|
}, {
|
|
4266
4156
|
readonly type: "error";
|
|
4267
4157
|
readonly name: "SignatureNotFound";
|
|
@@ -4272,16 +4162,12 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4272
4162
|
}];
|
|
4273
4163
|
}, {
|
|
4274
4164
|
readonly type: "error";
|
|
4275
|
-
readonly name: "
|
|
4165
|
+
readonly name: "UnauthorizedCallContext";
|
|
4276
4166
|
readonly inputs: readonly [];
|
|
4277
4167
|
}, {
|
|
4278
4168
|
readonly type: "error";
|
|
4279
|
-
readonly name: "
|
|
4280
|
-
readonly inputs: readonly [
|
|
4281
|
-
readonly name: "slot";
|
|
4282
|
-
readonly type: "bytes32";
|
|
4283
|
-
readonly internalType: "bytes32";
|
|
4284
|
-
}];
|
|
4169
|
+
readonly name: "UnsupportedOperation";
|
|
4170
|
+
readonly inputs: readonly [];
|
|
4285
4171
|
}];
|
|
4286
4172
|
private static readonly DOCUMENT_EVENT;
|
|
4287
4173
|
private static readonly COPY_EVENT;
|
|
@@ -4290,9 +4176,9 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4290
4176
|
private static readonly SIGNATURE_REVOCATION_EVENT;
|
|
4291
4177
|
private static readonly TIMESTAMP_EVENT;
|
|
4292
4178
|
/**
|
|
4293
|
-
* Creates a new
|
|
4179
|
+
* Creates a new Web3Sign instance.
|
|
4294
4180
|
*
|
|
4295
|
-
* @param address The address of the
|
|
4181
|
+
* @param address The address of the Web3Sign smart contract.
|
|
4296
4182
|
* @param web3pgp An instance implementing the IWeb3PGP interface for public key operations.
|
|
4297
4183
|
* @param client A Viem public client for interacting with the blockchain.
|
|
4298
4184
|
* @param walletClient Optional Viem wallet client for signing transactions.
|
|
@@ -4617,37 +4503,9 @@ declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
|
4617
4503
|
/*****************************************************************************************************************/
|
|
4618
4504
|
/*****************************************************************************************************************/
|
|
4619
4505
|
/**
|
|
4620
|
-
*
|
|
4621
|
-
*/
|
|
4622
|
-
declare class Web3DocServiceError extends Error {
|
|
4623
|
-
constructor(message: string);
|
|
4624
|
-
}
|
|
4625
|
-
/**
|
|
4626
|
-
* Error thrown when a critical failure occurs during service operations.
|
|
4627
|
-
*
|
|
4628
|
-
* This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.
|
|
4629
|
-
*/
|
|
4630
|
-
declare class Web3DocServiceCriticalError extends Web3DocServiceError {
|
|
4631
|
-
readonly cause?: Error | undefined;
|
|
4632
|
-
constructor(message: string, cause?: Error | undefined);
|
|
4633
|
-
}
|
|
4634
|
-
/**
|
|
4635
|
-
* Error thrown when document or blockchain data validation fails.
|
|
4636
|
-
*
|
|
4637
|
-
* This can happen because the smart contract does not validate the data it stores, they
|
|
4638
|
-
* have to be verified by the client application. Furthermore, as anyone can submit documents,
|
|
4639
|
-
* malformed or invalid data may be submitted by malicious actors.
|
|
4640
|
-
*/
|
|
4641
|
-
declare class Web3DocServiceValidationError extends Web3DocServiceError {
|
|
4642
|
-
readonly cause?: Error | undefined;
|
|
4643
|
-
constructor(message: string, cause?: Error | undefined);
|
|
4644
|
-
}
|
|
4645
|
-
/*****************************************************************************************************************/
|
|
4646
|
-
/*****************************************************************************************************************/
|
|
4647
|
-
/**
|
|
4648
|
-
* Configuration options for Web3DocService.
|
|
4506
|
+
* Configuration options for Web3SignService.
|
|
4649
4507
|
*/
|
|
4650
|
-
interface
|
|
4508
|
+
interface Web3SignServiceOptions {
|
|
4651
4509
|
/**
|
|
4652
4510
|
* Maximum number of concurrent operations performed when processing documents and verifying signatures.
|
|
4653
4511
|
*
|
|
@@ -4659,30 +4517,30 @@ interface Web3DocServiceOptions {
|
|
|
4659
4517
|
concurrencyLimit?: number;
|
|
4660
4518
|
}
|
|
4661
4519
|
/**
|
|
4662
|
-
* Implementation of the
|
|
4520
|
+
* Implementation of the Web3Sign service interface.
|
|
4663
4521
|
*
|
|
4664
4522
|
* This service provides high-level functions for managing documents on the blockchain with integrated
|
|
4665
4523
|
* OpenPGP operations to ease developer experience.
|
|
4666
4524
|
*/
|
|
4667
|
-
declare class
|
|
4525
|
+
declare class Web3SignService implements IWeb3SignService {
|
|
4668
4526
|
private _web3pgpService;
|
|
4669
|
-
private
|
|
4527
|
+
private _web3sign;
|
|
4670
4528
|
private _options;
|
|
4671
4529
|
/**
|
|
4672
|
-
* Creates a new
|
|
4530
|
+
* Creates a new Web3SignService instance.
|
|
4673
4531
|
*
|
|
4674
|
-
* @param
|
|
4532
|
+
* @param web3sign An instance implementing the IWeb3Sign interface.
|
|
4675
4533
|
* @param options Optional configuration options for the service.
|
|
4676
4534
|
*/
|
|
4677
|
-
constructor(
|
|
4535
|
+
constructor(web3sign: IWeb3Sign, web3pgpService: IWeb3PGPService, options?: Web3SignServiceOptions);
|
|
4678
4536
|
/**
|
|
4679
|
-
* Gets the
|
|
4537
|
+
* Gets the Web3Sign instance.
|
|
4680
4538
|
*/
|
|
4681
|
-
get
|
|
4539
|
+
get web3sign(): IWeb3Sign;
|
|
4682
4540
|
/**
|
|
4683
|
-
* Sets the
|
|
4541
|
+
* Sets the Web3Sign instance.
|
|
4684
4542
|
*/
|
|
4685
|
-
set
|
|
4543
|
+
set web3sign(value: IWeb3Sign);
|
|
4686
4544
|
/**
|
|
4687
4545
|
* Gets the Web3PGP service instance.
|
|
4688
4546
|
*/
|
|
@@ -4694,15 +4552,15 @@ declare class Web3DocService implements IWeb3DocService {
|
|
|
4694
4552
|
/**
|
|
4695
4553
|
* Gets the service configuration options.
|
|
4696
4554
|
*/
|
|
4697
|
-
get options(): Required<
|
|
4555
|
+
get options(): Required<Web3SignServiceOptions>;
|
|
4698
4556
|
/**
|
|
4699
4557
|
* Sets the service configuration options.
|
|
4700
4558
|
*/
|
|
4701
|
-
set options(value: Required<
|
|
4559
|
+
set options(value: Required<Web3SignServiceOptions>);
|
|
4702
4560
|
/*****************************************************************************************************************/
|
|
4703
4561
|
/*****************************************************************************************************************/
|
|
4704
4562
|
/**
|
|
4705
|
-
* This function allows submitting the data needed to timestamp a document to the
|
|
4563
|
+
* This function allows submitting the data needed to timestamp a document to the Web3Sign smart contract.
|
|
4706
4564
|
*
|
|
4707
4565
|
* The function will download and verify the emitter's public key using the Web3PGP contract and then it will verify
|
|
4708
4566
|
* the provided detached signature over the keccak256 hash of the document. If the signature is valid, it will submit
|
|
@@ -4719,7 +4577,7 @@ declare class Web3DocService implements IWeb3DocService {
|
|
|
4719
4577
|
timestamp(hash: Uint8Array, signature: openpgp.Signature, emitter: `0x${string}`): Promise<[bigint, TransactionReceipt]>;
|
|
4720
4578
|
/**
|
|
4721
4579
|
* Verifies a timestamp entry on the blockchain by its ID. The function retrieves the timestamp data from the
|
|
4722
|
-
*
|
|
4580
|
+
* Web3Sign smart contract and verifies the detached signature over the document hash using the emitter's public key.
|
|
4723
4581
|
*
|
|
4724
4582
|
* The function returns the document hash, the signature, and the public key used for verification.
|
|
4725
4583
|
*
|
|
@@ -4746,4 +4604,73 @@ declare class Web3DocService implements IWeb3DocService {
|
|
|
4746
4604
|
findTimestampsByHash(hash: Uint8Array): Promise<bigint[]>;
|
|
4747
4605
|
}
|
|
4748
4606
|
|
|
4749
|
-
|
|
4607
|
+
/**
|
|
4608
|
+
* Base error class for all Web3Sign-related errors.
|
|
4609
|
+
* Extends the native Error class to provide consistent error handling across the Web3Sign system.
|
|
4610
|
+
*/
|
|
4611
|
+
declare class Web3SignError extends Error {
|
|
4612
|
+
/**
|
|
4613
|
+
* Optional underlying error that caused this error.
|
|
4614
|
+
*/
|
|
4615
|
+
cause?: Error | undefined;
|
|
4616
|
+
/**
|
|
4617
|
+
* Creates a new Web3SignError instance.
|
|
4618
|
+
* @param message - Human-readable error description
|
|
4619
|
+
* @param cause - Optional underlying error that caused this error
|
|
4620
|
+
*/
|
|
4621
|
+
constructor(message: string, cause?: Error);
|
|
4622
|
+
}
|
|
4623
|
+
/**
|
|
4624
|
+
* Critical error class for unrecoverable Web3Sign errors.
|
|
4625
|
+
* Used when the system encounters a fatal condition that requires immediate attention.
|
|
4626
|
+
*/
|
|
4627
|
+
declare class Web3SignCriticalError extends Web3SignError {
|
|
4628
|
+
/**
|
|
4629
|
+
* Creates a new Web3SignCriticalError instance.
|
|
4630
|
+
* @param message - Human-readable error description
|
|
4631
|
+
* @param cause - Optional underlying error that caused this error
|
|
4632
|
+
*/
|
|
4633
|
+
constructor(message: string, cause?: Error);
|
|
4634
|
+
}
|
|
4635
|
+
/**
|
|
4636
|
+
* Base error class for Web3Sign service-related errors.
|
|
4637
|
+
* Used for errors that occur during service operations.
|
|
4638
|
+
*/
|
|
4639
|
+
declare class Web3SignServiceError extends Error {
|
|
4640
|
+
/**
|
|
4641
|
+
* Optional underlying error that caused this error.
|
|
4642
|
+
*/
|
|
4643
|
+
cause?: Error | undefined;
|
|
4644
|
+
/**
|
|
4645
|
+
* Creates a new Web3SignServiceError instance.
|
|
4646
|
+
* @param message - Human-readable error description
|
|
4647
|
+
* @param cause - Optional underlying error that caused this error
|
|
4648
|
+
*/
|
|
4649
|
+
constructor(message: string, cause?: Error);
|
|
4650
|
+
}
|
|
4651
|
+
/**
|
|
4652
|
+
* Validation error class for Web3Sign service validation failures.
|
|
4653
|
+
* Thrown when input validation fails or data does not meet required criteria.
|
|
4654
|
+
*/
|
|
4655
|
+
declare class Web3SignServiceValidationError extends Web3SignServiceError {
|
|
4656
|
+
/**
|
|
4657
|
+
* Creates a new Web3SignServiceValidationError instance.
|
|
4658
|
+
* @param message - Human-readable error description
|
|
4659
|
+
* @param cause - Optional underlying error that caused this error
|
|
4660
|
+
*/
|
|
4661
|
+
constructor(message: string, cause?: Error);
|
|
4662
|
+
}
|
|
4663
|
+
/**
|
|
4664
|
+
* Critical service error class for unrecoverable Web3Sign service errors.
|
|
4665
|
+
* Used when a service encounters a fatal condition that prevents continued operation.
|
|
4666
|
+
*/
|
|
4667
|
+
declare class Web3SignServiceCriticalError extends Web3SignServiceError {
|
|
4668
|
+
/**
|
|
4669
|
+
* Creates a new Web3SignServiceCriticalError instance.
|
|
4670
|
+
* @param message - Human-readable error description
|
|
4671
|
+
* @param cause - Optional underlying error that caused this error
|
|
4672
|
+
*/
|
|
4673
|
+
constructor(message: string, cause?: Error);
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
export { BYTES32_ZERO, type CopyLog, type DocumentLog, EventType, type FeesWithdrawnLog, FlatFee, HexTooLongError, type IFlatFee, type IWeb3PGP, type IWeb3PGPService, type IWeb3Sign, type IWeb3SignService, InvalidHexError, type KeyCertificationRevokedLog, type KeyCertifiedLog, type KeyRegisteredLog, type KeyRevokedLog, type KeyUpdatedLog, type NotificationLog, type OwnershipChallengedLog, type OwnershipProvedLog, type Recipient, type RequestedFeeUpdatedLog, type SignatureLog, type SignatureRevocationLog, type SubkeyAddedLog, type TimestampLog, Web3PGP, type Web3PGPEventLog, Web3PGPEvents, Web3PGPService, Web3PGPServiceCriticalError, Web3PGPServiceError, type Web3PGPServiceOptions, Web3PGPServiceValidationError, Web3Sign, Web3SignCriticalError, Web3SignError, Web3SignEvents, Web3SignService, Web3SignServiceCriticalError, Web3SignServiceError, Web3SignServiceValidationError, to0x, toBytes32 };
|