@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 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 | `0xb0b461aFA69b715d842c7fAb602f50D4cef83fe5` |
42
- | Arc | 1244 | `0xEa837218c7Ccd9eA1BCfB640e5c6aFE59952b4FA` |
43
- | Base | 84532 | `0x1a06530765e942a1D26B74d9558e9a1EdA615867` |
44
- | Ethereum | 11155111 | `0xABEa3399873b80f528Ee76286087b45ed38Fbf97` |
45
- | Arbitrum | 421614 | `0x2131De660C6be8b535E6f17E171bFf7143E9E9F4` |
46
- | Tempo | 42431 | `0xF3525FF8F592883f8fA2d89EfBe85637955Df487` |
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairblock/stabletrust",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "SDK for confidential transfers using homomorphic encryption and zero-knowledge proofs",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
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: "0xb0b461aFA69b715d842c7fAb602f50D4cef83fe5", //Stable
29
- 1244: "0xEa837218c7Ccd9eA1BCfB640e5c6aFE59952b4FA", //Arc
30
- 84532: "0x1a06530765e942a1D26B74d9558e9a1EdA615867", //Base
31
- 11155111: "0xABEa3399873b80f528Ee76286087b45ed38Fbf97", //Ethereum
32
- 421614: "0x2131De660C6be8b535E6f17E171bFf7143E9E9F4", //Arbitrum
33
- 42431: "0xF3525FF8F592883f8fA2d89EfBe85637955Df487", //Tempo
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: "Fairblock",
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.solidityPacked(
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: wallet.address,
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: wallet.address,
45
+ user: userAddress,
46
46
  purpose: "homomorphic-key-derive-v1",
47
47
  version: "1",
48
48
  });