@appliedblockchain/silentdatarollup-core 1.0.1 → 1.0.3
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/{chunk-LT2HDZHC.mjs → chunk-LTOM4BOX.mjs} +19 -2
- package/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +21 -1
- package/dist/index.mjs +7 -1
- package/dist/tests.js +7 -0
- package/dist/tests.mjs +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@ var SIGN_RPC_METHODS = [
|
|
|
6
6
|
"eth_getTransactionByHash",
|
|
7
7
|
"eth_getTransactionCount",
|
|
8
8
|
"eth_getProof",
|
|
9
|
-
"eth_getTransactionReceipt"
|
|
9
|
+
"eth_getTransactionReceipt",
|
|
10
|
+
"eth_estimateGas"
|
|
10
11
|
];
|
|
11
12
|
var eip721Domain = {
|
|
12
13
|
name: "Silent Data [Rollup]",
|
|
@@ -510,6 +511,9 @@ var CustomContractRunner = class {
|
|
|
510
511
|
"latest"
|
|
511
512
|
);
|
|
512
513
|
tx.nonce = latestNonce;
|
|
514
|
+
if (!tx.gasLimit) {
|
|
515
|
+
tx.gasLimit = await this.provider.estimateGas(tx);
|
|
516
|
+
}
|
|
513
517
|
return this.signer.sendTransaction(tx);
|
|
514
518
|
}
|
|
515
519
|
};
|
|
@@ -545,6 +549,16 @@ var SilentDataRollupContract = class extends Contract2 {
|
|
|
545
549
|
}
|
|
546
550
|
};
|
|
547
551
|
|
|
552
|
+
// src/privateEvents.ts
|
|
553
|
+
import { keccak256, toUtf8Bytes } from "ethers";
|
|
554
|
+
var PRIVATE_EVENT_SIGNATURE = "PrivateEvent(address[],bytes32,bytes)";
|
|
555
|
+
var PRIVATE_EVENT_SIGNATURE_HASH = keccak256(
|
|
556
|
+
toUtf8Bytes(PRIVATE_EVENT_SIGNATURE)
|
|
557
|
+
);
|
|
558
|
+
function calculateEventTypeHash(eventSignature) {
|
|
559
|
+
return keccak256(toUtf8Bytes(eventSignature));
|
|
560
|
+
}
|
|
561
|
+
|
|
548
562
|
export {
|
|
549
563
|
SIGN_RPC_METHODS,
|
|
550
564
|
eip721Domain,
|
|
@@ -573,5 +587,8 @@ export {
|
|
|
573
587
|
defaultGetDelegate,
|
|
574
588
|
prepareTypedDataPayload,
|
|
575
589
|
SilentDataRollupBase,
|
|
576
|
-
SilentDataRollupContract
|
|
590
|
+
SilentDataRollupContract,
|
|
591
|
+
PRIVATE_EVENT_SIGNATURE,
|
|
592
|
+
PRIVATE_EVENT_SIGNATURE_HASH,
|
|
593
|
+
calculateEventTypeHash
|
|
577
594
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -209,4 +209,30 @@ declare function isSignableContractCall(payload: JsonRpcPayload, contractMethods
|
|
|
209
209
|
declare const defaultGetDelegate: (provider: any) => Promise<Signer>;
|
|
210
210
|
declare const prepareTypedDataPayload: (p: JsonRpcPayload) => AuthSignatureMessageRequest;
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
/**
|
|
213
|
+
* The standard signature for the PrivateEvent as emitted by contracts
|
|
214
|
+
*/
|
|
215
|
+
declare const PRIVATE_EVENT_SIGNATURE = "PrivateEvent(address[],bytes32,bytes)";
|
|
216
|
+
/**
|
|
217
|
+
* The keccak256 hash of the PrivateEvent signature
|
|
218
|
+
* Used for filtering logs by event signature
|
|
219
|
+
*/
|
|
220
|
+
declare const PRIVATE_EVENT_SIGNATURE_HASH: string;
|
|
221
|
+
/**
|
|
222
|
+
* Interface describing the shape of a PrivateEvent
|
|
223
|
+
*/
|
|
224
|
+
interface PrivateEvent {
|
|
225
|
+
allowedViewers: string[];
|
|
226
|
+
eventType: string;
|
|
227
|
+
payload: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Calculate the keccak256 hash of an event signature
|
|
231
|
+
* This is used to create the eventType parameter for PrivateEvent
|
|
232
|
+
*
|
|
233
|
+
* @param eventSignature - The event signature (e.g., "Transfer(address,address,uint256)")
|
|
234
|
+
* @returns The keccak256 hash of the event signature
|
|
235
|
+
*/
|
|
236
|
+
declare function calculateEventTypeHash(eventSignature: string): string;
|
|
237
|
+
|
|
238
|
+
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_SIGNATURE, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload, signAuthHeaderRawMessage, signAuthHeaderTypedData, signRawDelegateHeader, signTypedDelegateHeader };
|
package/dist/index.d.ts
CHANGED
|
@@ -209,4 +209,30 @@ declare function isSignableContractCall(payload: JsonRpcPayload, contractMethods
|
|
|
209
209
|
declare const defaultGetDelegate: (provider: any) => Promise<Signer>;
|
|
210
210
|
declare const prepareTypedDataPayload: (p: JsonRpcPayload) => AuthSignatureMessageRequest;
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
/**
|
|
213
|
+
* The standard signature for the PrivateEvent as emitted by contracts
|
|
214
|
+
*/
|
|
215
|
+
declare const PRIVATE_EVENT_SIGNATURE = "PrivateEvent(address[],bytes32,bytes)";
|
|
216
|
+
/**
|
|
217
|
+
* The keccak256 hash of the PrivateEvent signature
|
|
218
|
+
* Used for filtering logs by event signature
|
|
219
|
+
*/
|
|
220
|
+
declare const PRIVATE_EVENT_SIGNATURE_HASH: string;
|
|
221
|
+
/**
|
|
222
|
+
* Interface describing the shape of a PrivateEvent
|
|
223
|
+
*/
|
|
224
|
+
interface PrivateEvent {
|
|
225
|
+
allowedViewers: string[];
|
|
226
|
+
eventType: string;
|
|
227
|
+
payload: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Calculate the keccak256 hash of an event signature
|
|
231
|
+
* This is used to create the eventType parameter for PrivateEvent
|
|
232
|
+
*
|
|
233
|
+
* @param eventSignature - The event signature (e.g., "Transfer(address,address,uint256)")
|
|
234
|
+
* @returns The keccak256 hash of the event signature
|
|
235
|
+
*/
|
|
236
|
+
declare function calculateEventTypeHash(eventSignature: string): string;
|
|
237
|
+
|
|
238
|
+
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_SIGNATURE, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload, signAuthHeaderRawMessage, signAuthHeaderTypedData, signRawDelegateHeader, signTypedDelegateHeader };
|
package/dist/index.js
CHANGED
|
@@ -42,11 +42,14 @@ __export(index_exports, {
|
|
|
42
42
|
HEADER_SIGNATURE: () => HEADER_SIGNATURE,
|
|
43
43
|
HEADER_TIMESTAMP: () => HEADER_TIMESTAMP,
|
|
44
44
|
NetworkName: () => NetworkName,
|
|
45
|
+
PRIVATE_EVENT_SIGNATURE: () => PRIVATE_EVENT_SIGNATURE,
|
|
46
|
+
PRIVATE_EVENT_SIGNATURE_HASH: () => PRIVATE_EVENT_SIGNATURE_HASH,
|
|
45
47
|
SIGN_RPC_METHODS: () => SIGN_RPC_METHODS,
|
|
46
48
|
SignatureType: () => SignatureType,
|
|
47
49
|
SilentDataRollupBase: () => SilentDataRollupBase,
|
|
48
50
|
SilentDataRollupContract: () => SilentDataRollupContract,
|
|
49
51
|
WHITELISTED_METHODS: () => WHITELISTED_METHODS,
|
|
52
|
+
calculateEventTypeHash: () => calculateEventTypeHash,
|
|
50
53
|
defaultGetDelegate: () => defaultGetDelegate,
|
|
51
54
|
delegateEIP721Types: () => delegateEIP721Types,
|
|
52
55
|
eip721Domain: () => eip721Domain,
|
|
@@ -69,7 +72,8 @@ var SIGN_RPC_METHODS = [
|
|
|
69
72
|
"eth_getTransactionByHash",
|
|
70
73
|
"eth_getTransactionCount",
|
|
71
74
|
"eth_getProof",
|
|
72
|
-
"eth_getTransactionReceipt"
|
|
75
|
+
"eth_getTransactionReceipt",
|
|
76
|
+
"eth_estimateGas"
|
|
73
77
|
];
|
|
74
78
|
var eip721Domain = {
|
|
75
79
|
name: "Silent Data [Rollup]",
|
|
@@ -569,6 +573,9 @@ var CustomContractRunner = class {
|
|
|
569
573
|
"latest"
|
|
570
574
|
);
|
|
571
575
|
tx.nonce = latestNonce;
|
|
576
|
+
if (!tx.gasLimit) {
|
|
577
|
+
tx.gasLimit = await this.provider.estimateGas(tx);
|
|
578
|
+
}
|
|
572
579
|
return this.signer.sendTransaction(tx);
|
|
573
580
|
}
|
|
574
581
|
};
|
|
@@ -603,6 +610,16 @@ var SilentDataRollupContract = class extends import_ethers2.Contract {
|
|
|
603
610
|
}
|
|
604
611
|
}
|
|
605
612
|
};
|
|
613
|
+
|
|
614
|
+
// src/privateEvents.ts
|
|
615
|
+
var import_ethers3 = require("ethers");
|
|
616
|
+
var PRIVATE_EVENT_SIGNATURE = "PrivateEvent(address[],bytes32,bytes)";
|
|
617
|
+
var PRIVATE_EVENT_SIGNATURE_HASH = (0, import_ethers3.keccak256)(
|
|
618
|
+
(0, import_ethers3.toUtf8Bytes)(PRIVATE_EVENT_SIGNATURE)
|
|
619
|
+
);
|
|
620
|
+
function calculateEventTypeHash(eventSignature) {
|
|
621
|
+
return (0, import_ethers3.keccak256)((0, import_ethers3.toUtf8Bytes)(eventSignature));
|
|
622
|
+
}
|
|
606
623
|
// Annotate the CommonJS export names for ESM import in node:
|
|
607
624
|
0 && (module.exports = {
|
|
608
625
|
ChainId,
|
|
@@ -617,11 +634,14 @@ var SilentDataRollupContract = class extends import_ethers2.Contract {
|
|
|
617
634
|
HEADER_SIGNATURE,
|
|
618
635
|
HEADER_TIMESTAMP,
|
|
619
636
|
NetworkName,
|
|
637
|
+
PRIVATE_EVENT_SIGNATURE,
|
|
638
|
+
PRIVATE_EVENT_SIGNATURE_HASH,
|
|
620
639
|
SIGN_RPC_METHODS,
|
|
621
640
|
SignatureType,
|
|
622
641
|
SilentDataRollupBase,
|
|
623
642
|
SilentDataRollupContract,
|
|
624
643
|
WHITELISTED_METHODS,
|
|
644
|
+
calculateEventTypeHash,
|
|
625
645
|
defaultGetDelegate,
|
|
626
646
|
delegateEIP721Types,
|
|
627
647
|
eip721Domain,
|
package/dist/index.mjs
CHANGED
|
@@ -11,11 +11,14 @@ import {
|
|
|
11
11
|
HEADER_SIGNATURE,
|
|
12
12
|
HEADER_TIMESTAMP,
|
|
13
13
|
NetworkName,
|
|
14
|
+
PRIVATE_EVENT_SIGNATURE,
|
|
15
|
+
PRIVATE_EVENT_SIGNATURE_HASH,
|
|
14
16
|
SIGN_RPC_METHODS,
|
|
15
17
|
SignatureType,
|
|
16
18
|
SilentDataRollupBase,
|
|
17
19
|
SilentDataRollupContract,
|
|
18
20
|
WHITELISTED_METHODS,
|
|
21
|
+
calculateEventTypeHash,
|
|
19
22
|
defaultGetDelegate,
|
|
20
23
|
delegateEIP721Types,
|
|
21
24
|
eip721Domain,
|
|
@@ -27,7 +30,7 @@ import {
|
|
|
27
30
|
signAuthHeaderTypedData,
|
|
28
31
|
signRawDelegateHeader,
|
|
29
32
|
signTypedDelegateHeader
|
|
30
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-LTOM4BOX.mjs";
|
|
31
34
|
export {
|
|
32
35
|
ChainId,
|
|
33
36
|
DEBUG_NAMESPACE,
|
|
@@ -41,11 +44,14 @@ export {
|
|
|
41
44
|
HEADER_SIGNATURE,
|
|
42
45
|
HEADER_TIMESTAMP,
|
|
43
46
|
NetworkName,
|
|
47
|
+
PRIVATE_EVENT_SIGNATURE,
|
|
48
|
+
PRIVATE_EVENT_SIGNATURE_HASH,
|
|
44
49
|
SIGN_RPC_METHODS,
|
|
45
50
|
SignatureType,
|
|
46
51
|
SilentDataRollupBase,
|
|
47
52
|
SilentDataRollupContract,
|
|
48
53
|
WHITELISTED_METHODS,
|
|
54
|
+
calculateEventTypeHash,
|
|
49
55
|
defaultGetDelegate,
|
|
50
56
|
delegateEIP721Types,
|
|
51
57
|
eip721Domain,
|
package/dist/tests.js
CHANGED
|
@@ -52,6 +52,13 @@ var log2 = (0, import_debug2.default)(DEBUG_NAMESPACE);
|
|
|
52
52
|
// src/contract.ts
|
|
53
53
|
var import_ethers2 = require("ethers");
|
|
54
54
|
|
|
55
|
+
// src/privateEvents.ts
|
|
56
|
+
var import_ethers3 = require("ethers");
|
|
57
|
+
var PRIVATE_EVENT_SIGNATURE = "PrivateEvent(address[],bytes32,bytes)";
|
|
58
|
+
var PRIVATE_EVENT_SIGNATURE_HASH = (0, import_ethers3.keccak256)(
|
|
59
|
+
(0, import_ethers3.toUtf8Bytes)(PRIVATE_EVENT_SIGNATURE)
|
|
60
|
+
);
|
|
61
|
+
|
|
55
62
|
// tests/utils/mocked-custom-grpc.ts
|
|
56
63
|
var import_http = __toESM(require("http"));
|
|
57
64
|
var currentPort = 3e3;
|
package/dist/tests.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliedblockchain/silentdatarollup-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Core library for Silent Data [Rollup]",
|
|
5
5
|
"author": "Applied Blockchain",
|
|
6
6
|
"homepage": "https://github.com/appliedblockchain/silent-data-rollup-providers#readme",
|