@fairblock/stabletrust 1.0.15 → 1.0.16
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/README.md +6 -6
- package/examples/complete-flow.js +1 -8
- package/package.json +1 -1
- package/src/constants.js +6 -6
- package/src/crypto.js +5 -5
package/README.md
CHANGED
|
@@ -38,12 +38,12 @@ The following contract addresses are available for confidential transfers on tes
|
|
|
38
38
|
|
|
39
39
|
| Network(Testnet) | Chain ID | Contract Address |
|
|
40
40
|
| :--------------- | :------- | :------------------------------------------- |
|
|
41
|
-
| Stable | 2201 | `
|
|
42
|
-
| Arc | 1244 | `
|
|
43
|
-
| Base | 84532 | `
|
|
44
|
-
| Ethereum | 11155111 | `
|
|
45
|
-
| Arbitrum | 421614 | `
|
|
46
|
-
| Tempo | 42431 | `
|
|
41
|
+
| Stable | 2201 | `0xB96aa42b246a956B170fE426A72fB610E4976f9E` |
|
|
42
|
+
| Arc | 1244 | `0xb20aB54e1c6AE55B0DD11FEB7FFf3fF1E9631f19` |
|
|
43
|
+
| Base | 84532 | `0x962a8A7CD28BfFBb17C4F6Ec388782cca3ffd618` |
|
|
44
|
+
| Ethereum | 11155111 | `0x2E48F3D9b8F4aCA9E6AF0630eaB2ceB7A3f5eEd1` |
|
|
45
|
+
| Arbitrum | 421614 | `0x14Afd604971bee5b5fac52df2d56CaE421519Cc5` |
|
|
46
|
+
| Tempo | 42431 | `0x08B6563C95dfe3a4F5533CAA6F7D55a74FCb4F6c` |
|
|
47
47
|
|
|
48
48
|
## Usage
|
|
49
49
|
|
|
@@ -11,9 +11,6 @@ dotenv.config();
|
|
|
11
11
|
* https://docs.fairblock.network/docs/confidential_transfers/technical_overview
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
// Optional override for custom confidential contract deployments.
|
|
15
|
-
const CONTRACT_ADDRESS =
|
|
16
|
-
process.env.CONTRACT_ADDRESS || "0xb0b461aFA69b715d842c7fAb602f50D4cef83fe5";
|
|
17
14
|
// Standard ERC20 token contract. Any ERC20 on this chain ID can be used.
|
|
18
15
|
const TOKEN_ADDRESS =
|
|
19
16
|
process.env.TOKEN_ADDRESS || "0x78Cf24370174180738C5B8E352B6D14c83a6c9A9";
|
|
@@ -42,11 +39,7 @@ async function trackPerformance(actionName, action) {
|
|
|
42
39
|
async function main() {
|
|
43
40
|
console.log("=== Starting Confidential Flow Performance Test ===\n");
|
|
44
41
|
|
|
45
|
-
const client = new ConfidentialTransferClient(
|
|
46
|
-
RPC_URL,
|
|
47
|
-
CONTRACT_ADDRESS,
|
|
48
|
-
Number(CHAIN_ID),
|
|
49
|
-
);
|
|
42
|
+
const client = new ConfidentialTransferClient(RPC_URL, Number(CHAIN_ID));
|
|
50
43
|
|
|
51
44
|
const provider = new ethers.JsonRpcProvider(RPC_URL);
|
|
52
45
|
const sender = new ethers.Wallet(process.env.SENDER_PRIVATE_KEY, provider);
|
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -25,12 +25,12 @@ export const TEMPO_FEE_TOKEN_ADDRESS =
|
|
|
25
25
|
"0x20c0000000000000000000000000000000000000";
|
|
26
26
|
|
|
27
27
|
export const STABLETRUST_CONTRACTS_BY_CHAIN_ID = Object.freeze({
|
|
28
|
-
2201: "
|
|
29
|
-
1244: "
|
|
30
|
-
84532: "
|
|
31
|
-
11155111: "
|
|
32
|
-
421614: "
|
|
33
|
-
42431: "
|
|
28
|
+
2201: "0xB96aa42b246a956B170fE426A72fB610E4976f9E", //Stable
|
|
29
|
+
1244: "0xb20aB54e1c6AE55B0DD11FEB7FFf3fF1E9631f19", //Arc
|
|
30
|
+
84532: "0x962a8A7CD28BfFBb17C4F6Ec388782cca3ffd618", //Base
|
|
31
|
+
11155111: "0x2E48F3D9b8F4aCA9E6AF0630eaB2ceB7A3f5eEd1", //Ethereum
|
|
32
|
+
421614: "0x14Afd604971bee5b5fac52df2d56CaE421519Cc5", //Arbitrum
|
|
33
|
+
42431: "0x08B6563C95dfe3a4F5533CAA6F7D55a74FCb4F6c", //Tempo
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
export function getStableTrustContractAddress(chainId) {
|
package/src/crypto.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ethers } from "ethers";
|
|
|
11
11
|
*/
|
|
12
12
|
export async function deriveKeys(wallet, config, generateKeypair) {
|
|
13
13
|
const domain = {
|
|
14
|
-
name: "
|
|
14
|
+
name: "ConfidentialTokens",
|
|
15
15
|
version: "1",
|
|
16
16
|
chainId: config.chainId,
|
|
17
17
|
verifyingContract: config.contractAddress,
|
|
@@ -26,15 +26,15 @@ export async function deriveKeys(wallet, config, generateKeypair) {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const contextHash = ethers.keccak256(
|
|
29
|
-
ethers.
|
|
29
|
+
ethers.AbiCoder.defaultAbiCoder().encode(
|
|
30
30
|
["uint256", "address", "address", "string"],
|
|
31
31
|
[config.chainId, config.contractAddress, ethers.ZeroAddress, "main"],
|
|
32
32
|
),
|
|
33
33
|
);
|
|
34
|
-
|
|
34
|
+
const userAddress = wallet.address.toLowerCase();
|
|
35
35
|
const message = {
|
|
36
36
|
purpose: "homomorphic-key-derive-v1",
|
|
37
|
-
user:
|
|
37
|
+
user: userAddress,
|
|
38
38
|
context: contextHash,
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ export async function deriveKeys(wallet, config, generateKeypair) {
|
|
|
42
42
|
const domainContext = JSON.stringify({
|
|
43
43
|
chainId: config.chainId.toString(),
|
|
44
44
|
verifyingContract: config.contractAddress,
|
|
45
|
-
user:
|
|
45
|
+
user: userAddress,
|
|
46
46
|
purpose: "homomorphic-key-derive-v1",
|
|
47
47
|
version: "1",
|
|
48
48
|
});
|