@skalenetwork/privacy-sdk 0.1.0-develop.0 → 0.1.0-develop.2

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.
@@ -1,26 +1,24 @@
1
1
  import { Hex } from 'viem';
2
- import { A as ActionConfig, a as ApproveParams, T as TransferParams, U as UnwrapParams, W as WrapParams, b as TopUpParams, D as DecryptHistoricTransferDataParams, c as DecryptBalanceParams, G as GetTransferIdParams, d as AuthorizeHistoricViewForRangeParams, e as AuthorizeHistoricViewForTransferParams, R as RegisterViewerKeyParams, f as RequestTransferDecryptionParams, g as RevokeHistoricViewParams } from '../types-CBDYydn0.cjs';
3
- import { T as TransferData } from '../types-WaeCtQlG.cjs';
2
+ import { A as ActionConfig } from '../types-T84pCSPm.cjs';
4
3
  import '@skalenetwork/bite';
4
+ import '../types-WaeCtQlG.cjs';
5
5
 
6
- declare function approve(config: ActionConfig, params: ApproveParams): Promise<Hex>;
7
- declare function transfer(config: ActionConfig, params: TransferParams): Promise<Hex>;
8
- declare function wrap(config: ActionConfig, params: WrapParams): Promise<Hex>;
9
- declare function unwrap(config: ActionConfig, params: UnwrapParams): Promise<Hex>;
6
+ declare function approve(config: ActionConfig, spender: Hex, amount: bigint): Promise<Hex>;
7
+ declare function transfer(config: ActionConfig, to: Hex, amount: bigint): Promise<Hex>;
8
+ declare function wrap(config: ActionConfig, receiver: Hex, amount: bigint): Promise<Hex>;
9
+ declare function unwrap(config: ActionConfig, receiver: Hex, amount: bigint): Promise<Hex>;
10
10
 
11
11
  declare function getCtxBalance(config: ActionConfig): Promise<bigint>;
12
- declare function getCtxFee(config: ActionConfig): Promise<bigint>;
13
- declare function fundCtxBalance(config: ActionConfig, params: TopUpParams): Promise<Hex>;
14
- declare function getValueForCtx(config: ActionConfig): Promise<bigint>;
12
+ declare function getCtxRawCost(config: ActionConfig): Promise<bigint>;
13
+ declare function getCtxOperationCost(config: ActionConfig): Promise<bigint>;
15
14
 
16
- declare function decryptTokenBalance(config: ActionConfig, params: DecryptBalanceParams): Promise<bigint>;
17
- declare function decryptHistoricTransferData(params: DecryptHistoricTransferDataParams): Promise<TransferData>;
18
- declare function getTransferId(config: ActionConfig, params: GetTransferIdParams): Promise<bigint>;
15
+ declare function decryptTokenBalance(config: ActionConfig, viewerKey: Hex): Promise<bigint>;
16
+ declare function getTransferId(config: ActionConfig, ctxHash: Hex): Promise<bigint>;
19
17
 
20
- declare function registerViewerKey(config: ActionConfig, params: RegisterViewerKeyParams): Promise<Hex>;
21
- declare function authorizeHistoricViewForRange(config: ActionConfig, params: AuthorizeHistoricViewForRangeParams): Promise<Hex>;
22
- declare function authorizeHistoricViewForTransfer(config: ActionConfig, params: AuthorizeHistoricViewForTransferParams): Promise<Hex>;
23
- declare function revokeHistoricView(config: ActionConfig, params: RevokeHistoricViewParams): Promise<Hex>;
24
- declare function requestTransferDecryption(config: ActionConfig, params: RequestTransferDecryptionParams): Promise<Hex>;
18
+ declare function registerViewerKey(config: ActionConfig, publicKey: Hex): Promise<Hex>;
19
+ declare function authorizeHistoricViewForRange(config: ActionConfig, address: Hex, fromTimestamp: bigint, toTimestamp: bigint): Promise<Hex>;
20
+ declare function authorizeHistoricViewForTransfer(config: ActionConfig, address: Hex, transferId: bigint): Promise<Hex>;
21
+ declare function revokeHistoricView(config: ActionConfig, address: Hex): Promise<Hex>;
22
+ declare function requestTransferDecryption(config: ActionConfig, ctxHash: Hex): Promise<Hex>;
25
23
 
26
- export { ActionConfig, ApproveParams, AuthorizeHistoricViewForRangeParams, AuthorizeHistoricViewForTransferParams, DecryptBalanceParams, DecryptHistoricTransferDataParams, GetTransferIdParams, RegisterViewerKeyParams, RequestTransferDecryptionParams, RevokeHistoricViewParams, TopUpParams, TransferParams, UnwrapParams, WrapParams, approve, authorizeHistoricViewForRange, authorizeHistoricViewForTransfer, decryptHistoricTransferData, decryptTokenBalance, fundCtxBalance, getCtxBalance, getCtxFee, getTransferId, getValueForCtx, registerViewerKey, requestTransferDecryption, revokeHistoricView, transfer, unwrap, wrap };
24
+ export { ActionConfig, approve, authorizeHistoricViewForRange, authorizeHistoricViewForTransfer, decryptTokenBalance, getCtxBalance, getCtxRawCost as getCtxFee, getTransferId, getCtxOperationCost as getValueForCtx, registerViewerKey, requestTransferDecryption, revokeHistoricView, transfer, unwrap, wrap };
@@ -1,26 +1,24 @@
1
1
  import { Hex } from 'viem';
2
- import { A as ActionConfig, a as ApproveParams, T as TransferParams, U as UnwrapParams, W as WrapParams, b as TopUpParams, D as DecryptHistoricTransferDataParams, c as DecryptBalanceParams, G as GetTransferIdParams, d as AuthorizeHistoricViewForRangeParams, e as AuthorizeHistoricViewForTransferParams, R as RegisterViewerKeyParams, f as RequestTransferDecryptionParams, g as RevokeHistoricViewParams } from '../types-Gn0F4pQf.js';
3
- import { T as TransferData } from '../types-WaeCtQlG.js';
2
+ import { A as ActionConfig } from '../types-CPLzL9IK.js';
4
3
  import '@skalenetwork/bite';
4
+ import '../types-WaeCtQlG.js';
5
5
 
6
- declare function approve(config: ActionConfig, params: ApproveParams): Promise<Hex>;
7
- declare function transfer(config: ActionConfig, params: TransferParams): Promise<Hex>;
8
- declare function wrap(config: ActionConfig, params: WrapParams): Promise<Hex>;
9
- declare function unwrap(config: ActionConfig, params: UnwrapParams): Promise<Hex>;
6
+ declare function approve(config: ActionConfig, spender: Hex, amount: bigint): Promise<Hex>;
7
+ declare function transfer(config: ActionConfig, to: Hex, amount: bigint): Promise<Hex>;
8
+ declare function wrap(config: ActionConfig, receiver: Hex, amount: bigint): Promise<Hex>;
9
+ declare function unwrap(config: ActionConfig, receiver: Hex, amount: bigint): Promise<Hex>;
10
10
 
11
11
  declare function getCtxBalance(config: ActionConfig): Promise<bigint>;
12
- declare function getCtxFee(config: ActionConfig): Promise<bigint>;
13
- declare function fundCtxBalance(config: ActionConfig, params: TopUpParams): Promise<Hex>;
14
- declare function getValueForCtx(config: ActionConfig): Promise<bigint>;
12
+ declare function getCtxRawCost(config: ActionConfig): Promise<bigint>;
13
+ declare function getCtxOperationCost(config: ActionConfig): Promise<bigint>;
15
14
 
16
- declare function decryptTokenBalance(config: ActionConfig, params: DecryptBalanceParams): Promise<bigint>;
17
- declare function decryptHistoricTransferData(params: DecryptHistoricTransferDataParams): Promise<TransferData>;
18
- declare function getTransferId(config: ActionConfig, params: GetTransferIdParams): Promise<bigint>;
15
+ declare function decryptTokenBalance(config: ActionConfig, viewerKey: Hex): Promise<bigint>;
16
+ declare function getTransferId(config: ActionConfig, ctxHash: Hex): Promise<bigint>;
19
17
 
20
- declare function registerViewerKey(config: ActionConfig, params: RegisterViewerKeyParams): Promise<Hex>;
21
- declare function authorizeHistoricViewForRange(config: ActionConfig, params: AuthorizeHistoricViewForRangeParams): Promise<Hex>;
22
- declare function authorizeHistoricViewForTransfer(config: ActionConfig, params: AuthorizeHistoricViewForTransferParams): Promise<Hex>;
23
- declare function revokeHistoricView(config: ActionConfig, params: RevokeHistoricViewParams): Promise<Hex>;
24
- declare function requestTransferDecryption(config: ActionConfig, params: RequestTransferDecryptionParams): Promise<Hex>;
18
+ declare function registerViewerKey(config: ActionConfig, publicKey: Hex): Promise<Hex>;
19
+ declare function authorizeHistoricViewForRange(config: ActionConfig, address: Hex, fromTimestamp: bigint, toTimestamp: bigint): Promise<Hex>;
20
+ declare function authorizeHistoricViewForTransfer(config: ActionConfig, address: Hex, transferId: bigint): Promise<Hex>;
21
+ declare function revokeHistoricView(config: ActionConfig, address: Hex): Promise<Hex>;
22
+ declare function requestTransferDecryption(config: ActionConfig, ctxHash: Hex): Promise<Hex>;
25
23
 
26
- export { ActionConfig, ApproveParams, AuthorizeHistoricViewForRangeParams, AuthorizeHistoricViewForTransferParams, DecryptBalanceParams, DecryptHistoricTransferDataParams, GetTransferIdParams, RegisterViewerKeyParams, RequestTransferDecryptionParams, RevokeHistoricViewParams, TopUpParams, TransferParams, UnwrapParams, WrapParams, approve, authorizeHistoricViewForRange, authorizeHistoricViewForTransfer, decryptHistoricTransferData, decryptTokenBalance, fundCtxBalance, getCtxBalance, getCtxFee, getTransferId, getValueForCtx, registerViewerKey, requestTransferDecryption, revokeHistoricView, transfer, unwrap, wrap };
24
+ export { ActionConfig, approve, authorizeHistoricViewForRange, authorizeHistoricViewForTransfer, decryptTokenBalance, getCtxBalance, getCtxRawCost as getCtxFee, getTransferId, getCtxOperationCost as getValueForCtx, registerViewerKey, requestTransferDecryption, revokeHistoricView, transfer, unwrap, wrap };
@@ -2,32 +2,28 @@ import {
2
2
  approve,
3
3
  authorizeHistoricViewForRange,
4
4
  authorizeHistoricViewForTransfer,
5
- decryptHistoricTransferData,
6
5
  decryptTokenBalance,
7
- fundCtxBalance,
8
6
  getCtxBalance,
9
- getCtxFee,
7
+ getCtxOperationCost,
8
+ getCtxRawCost,
10
9
  getTransferId,
11
- getValueForCtx,
12
10
  registerViewerKey,
13
11
  requestTransferDecryption,
14
12
  revokeHistoricView,
15
13
  transfer,
16
14
  unwrap,
17
15
  wrap
18
- } from "../chunk-YEII26VS.js";
16
+ } from "../chunk-PMT6KSGL.js";
19
17
  import "../chunk-K5WS3F4Q.js";
20
18
  export {
21
19
  approve,
22
20
  authorizeHistoricViewForRange,
23
21
  authorizeHistoricViewForTransfer,
24
- decryptHistoricTransferData,
25
22
  decryptTokenBalance,
26
- fundCtxBalance,
27
23
  getCtxBalance,
28
- getCtxFee,
24
+ getCtxRawCost as getCtxFee,
29
25
  getTransferId,
30
- getValueForCtx,
26
+ getCtxOperationCost as getValueForCtx,
31
27
  registerViewerKey,
32
28
  requestTransferDecryption,
33
29
  revokeHistoricView,
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  decryptBalance,
3
- decryptTransferData,
4
3
  parsePublicKeyCoordinates
5
4
  } from "./chunk-K5WS3F4Q.js";
6
5
 
7
6
  // src/actions/transfers.ts
8
- import { encodeFunctionData as encodeFunctionData2, toHex } from "viem";
7
+ import { encodeAbiParameters, encodeFunctionData } from "viem";
9
8
 
10
9
  // src/abi/confidentialWrapper.ts
11
10
  var confidentialWrapperAbi = [
12
11
  {
13
12
  inputs: [
13
+ {
14
+ internalType: "bool",
15
+ name: "proxyMode",
16
+ type: "bool"
17
+ },
14
18
  {
15
19
  internalType: "contract IERC20Metadata",
16
20
  name: "underlyingToken",
@@ -576,6 +580,11 @@ var confidentialWrapperAbi = [
576
580
  name: "InvalidDataOffset",
577
581
  type: "error"
578
582
  },
583
+ {
584
+ inputs: [],
585
+ name: "InvalidInitialization",
586
+ type: "error"
587
+ },
579
588
  {
580
589
  inputs: [],
581
590
  name: "InvalidPublicKey",
@@ -604,7 +613,7 @@ var confidentialWrapperAbi = [
604
613
  },
605
614
  {
606
615
  inputs: [],
607
- name: "InvalidShortString",
616
+ name: "InvalidSaltForTransactionValue",
608
617
  type: "error"
609
618
  },
610
619
  {
@@ -650,6 +659,11 @@ var confidentialWrapperAbi = [
650
659
  name: "NoViewerRegisteredForHolder",
651
660
  type: "error"
652
661
  },
662
+ {
663
+ inputs: [],
664
+ name: "NotInitializing",
665
+ type: "error"
666
+ },
653
667
  {
654
668
  inputs: [
655
669
  {
@@ -688,17 +702,6 @@ var confidentialWrapperAbi = [
688
702
  name: "SafeERC20FailedOperation",
689
703
  type: "error"
690
704
  },
691
- {
692
- inputs: [
693
- {
694
- internalType: "string",
695
- name: "str",
696
- type: "string"
697
- }
698
- ],
699
- name: "StringTooLong",
700
- type: "error"
701
- },
702
705
  {
703
706
  inputs: [
704
707
  {
@@ -758,6 +761,11 @@ var confidentialWrapperAbi = [
758
761
  name: "ValueWasNotEncryptedCorrectly",
759
762
  type: "error"
760
763
  },
764
+ {
765
+ inputs: [],
766
+ name: "WrongInitializer",
767
+ type: "error"
768
+ },
761
769
  {
762
770
  inputs: [],
763
771
  name: "WrongPlaintextFormat",
@@ -1114,6 +1122,19 @@ var confidentialWrapperAbi = [
1114
1122
  name: "HistoricViewTransferIdRevoked",
1115
1123
  type: "event"
1116
1124
  },
1125
+ {
1126
+ anonymous: false,
1127
+ inputs: [
1128
+ {
1129
+ indexed: false,
1130
+ internalType: "uint64",
1131
+ name: "version",
1132
+ type: "uint64"
1133
+ }
1134
+ ],
1135
+ name: "Initialized",
1136
+ type: "event"
1137
+ },
1117
1138
  {
1118
1139
  anonymous: false,
1119
1140
  inputs: [
@@ -1746,6 +1767,30 @@ var confidentialWrapperAbi = [
1746
1767
  stateMutability: "view",
1747
1768
  type: "function"
1748
1769
  },
1770
+ {
1771
+ inputs: [
1772
+ {
1773
+ internalType: "address",
1774
+ name: "holder",
1775
+ type: "address"
1776
+ },
1777
+ {
1778
+ internalType: "uint256",
1779
+ name: "value",
1780
+ type: "uint256"
1781
+ }
1782
+ ],
1783
+ name: "encryptValue",
1784
+ outputs: [
1785
+ {
1786
+ internalType: "bytes",
1787
+ name: "encryptedValue",
1788
+ type: "bytes"
1789
+ }
1790
+ ],
1791
+ stateMutability: "view",
1792
+ type: "function"
1793
+ },
1749
1794
  {
1750
1795
  inputs: [
1751
1796
  {
@@ -1815,7 +1860,7 @@ var confidentialWrapperAbi = [
1815
1860
  ],
1816
1861
  name: "encryptedReceiveWithAuthorization",
1817
1862
  outputs: [],
1818
- stateMutability: "nonpayable",
1863
+ stateMutability: "payable",
1819
1864
  type: "function"
1820
1865
  },
1821
1866
  {
@@ -1944,6 +1989,57 @@ var confidentialWrapperAbi = [
1944
1989
  stateMutability: "view",
1945
1990
  type: "function"
1946
1991
  },
1992
+ {
1993
+ inputs: [
1994
+ {
1995
+ internalType: "string",
1996
+ name: "",
1997
+ type: "string"
1998
+ },
1999
+ {
2000
+ internalType: "string",
2001
+ name: "",
2002
+ type: "string"
2003
+ },
2004
+ {
2005
+ internalType: "string",
2006
+ name: "",
2007
+ type: "string"
2008
+ },
2009
+ {
2010
+ internalType: "address",
2011
+ name: "",
2012
+ type: "address"
2013
+ }
2014
+ ],
2015
+ name: "initialize",
2016
+ outputs: [],
2017
+ stateMutability: "pure",
2018
+ type: "function"
2019
+ },
2020
+ {
2021
+ inputs: [
2022
+ {
2023
+ internalType: "contract IERC20Metadata",
2024
+ name: "underlyingToken",
2025
+ type: "address"
2026
+ },
2027
+ {
2028
+ internalType: "string",
2029
+ name: "version_",
2030
+ type: "string"
2031
+ },
2032
+ {
2033
+ internalType: "address",
2034
+ name: "initialAuthority",
2035
+ type: "address"
2036
+ }
2037
+ ],
2038
+ name: "initialize",
2039
+ outputs: [],
2040
+ stateMutability: "nonpayable",
2041
+ type: "function"
2042
+ },
1947
2043
  {
1948
2044
  inputs: [],
1949
2045
  name: "isConsumingScheduledOp",
@@ -2648,7 +2744,6 @@ var confidentialWrapperAbi = [
2648
2744
  ];
2649
2745
 
2650
2746
  // src/actions/funding.ts
2651
- import { encodeFunctionData } from "viem";
2652
2747
  var CTX_RESERVE_THRESHOLD = 1n;
2653
2748
  async function getCtxBalance(config) {
2654
2749
  return await config.publicClient.readContract({
@@ -2658,73 +2753,64 @@ async function getCtxBalance(config) {
2658
2753
  args: [config.signer.address]
2659
2754
  });
2660
2755
  }
2661
- async function getCtxFee(config) {
2756
+ async function getCtxRawCost(config) {
2662
2757
  return await config.publicClient.readContract({
2663
2758
  address: config.address,
2664
2759
  abi: confidentialWrapperAbi,
2665
2760
  functionName: "callbackFee"
2666
2761
  });
2667
2762
  }
2668
- async function fundCtxBalance(config, params) {
2669
- const data = encodeFunctionData({
2670
- abi: confidentialWrapperAbi,
2671
- functionName: "fundWithGasToken",
2672
- args: [config.signer.address]
2673
- });
2674
- return config.signer.sendTransaction({
2675
- to: config.address,
2676
- data,
2677
- value: params.amount
2678
- });
2679
- }
2680
- async function getValueForCtx(config) {
2681
- const [fee, balance] = await Promise.all([getCtxFee(config), getCtxBalance(config)]);
2763
+ async function getCtxOperationCost(config) {
2764
+ const [fee, balance] = await Promise.all([getCtxRawCost(config), getCtxBalance(config)]);
2682
2765
  const topUp = CTX_RESERVE_THRESHOLD * fee - balance;
2683
2766
  return fee + (topUp > 0n ? topUp : 0n);
2684
2767
  }
2685
2768
 
2686
2769
  // src/actions/transfers.ts
2687
- async function approve(config, params) {
2688
- const data = encodeFunctionData2({
2770
+ async function approve(config, spender, amount) {
2771
+ const data = encodeFunctionData({
2689
2772
  abi: confidentialWrapperAbi,
2690
2773
  functionName: "approve",
2691
- args: [params.spender, params.amount]
2774
+ args: [spender, amount]
2692
2775
  });
2693
2776
  return config.signer.sendTransaction({ to: config.address, data });
2694
2777
  }
2695
- async function transfer(config, params) {
2696
- const value = await getValueForCtx(config);
2697
- const valueHex = toHex(params.amount, { size: 32 });
2778
+ async function transfer(config, to, amount) {
2779
+ const value = await getCtxOperationCost(config);
2780
+ const valueHex = encodeAbiParameters(
2781
+ [{ type: "address" }, { type: "uint256" }],
2782
+ [config.signer.address, amount]
2783
+ );
2698
2784
  const encryptedValue = await config.bite.encryptMessageForCTX(valueHex, config.address);
2699
- const data = encodeFunctionData2({
2785
+ const data = encodeFunctionData({
2700
2786
  abi: confidentialWrapperAbi,
2701
2787
  functionName: "encryptedTransfer",
2702
- args: [params.to, encryptedValue]
2788
+ args: [to, encryptedValue]
2703
2789
  });
2704
2790
  return config.signer.sendTransaction({ to: config.address, data, value });
2705
2791
  }
2706
- async function wrap(config, params) {
2707
- const value = await getValueForCtx(config);
2708
- const data = encodeFunctionData2({
2792
+ async function wrap(config, receiver, amount) {
2793
+ const value = await getCtxOperationCost(config);
2794
+ const data = encodeFunctionData({
2709
2795
  abi: confidentialWrapperAbi,
2710
2796
  functionName: "depositForWithGasToken",
2711
- args: [params.receiver, params.amount]
2797
+ args: [receiver, amount]
2712
2798
  });
2713
2799
  return config.signer.sendTransaction({ to: config.address, data, value });
2714
2800
  }
2715
- async function unwrap(config, params) {
2716
- const value = await getValueForCtx(config);
2717
- const data = encodeFunctionData2({
2801
+ async function unwrap(config, receiver, amount) {
2802
+ const value = await getCtxOperationCost(config);
2803
+ const data = encodeFunctionData({
2718
2804
  abi: confidentialWrapperAbi,
2719
2805
  functionName: "withdrawToWithGasToken",
2720
- args: [params.receiver, params.amount]
2806
+ args: [receiver, amount]
2721
2807
  });
2722
2808
  return config.signer.sendTransaction({ to: config.address, data, value });
2723
2809
  }
2724
2810
 
2725
2811
  // src/actions/decrypt.ts
2726
2812
  import { bytesToHex, parseEventLogs } from "viem";
2727
- async function decryptTokenBalance(config, params) {
2813
+ async function decryptTokenBalance(config, viewerKey) {
2728
2814
  const raw = await config.publicClient.readContract({
2729
2815
  address: config.address,
2730
2816
  abi: confidentialWrapperAbi,
@@ -2732,13 +2818,10 @@ async function decryptTokenBalance(config, params) {
2732
2818
  args: [config.signer.address]
2733
2819
  });
2734
2820
  const encryptedHex = typeof raw === "string" ? raw : bytesToHex(raw);
2735
- return decryptBalance(encryptedHex, params.viewerKey);
2821
+ return decryptBalance(encryptedHex, viewerKey);
2736
2822
  }
2737
- async function decryptHistoricTransferData(params) {
2738
- return decryptTransferData(params.encryptedData, params.viewerKey);
2739
- }
2740
- async function getTransferId(config, params) {
2741
- const receipt = await config.publicClient.waitForTransactionReceipt({ hash: params.ctxHash });
2823
+ async function getTransferId(config, ctxHash) {
2824
+ const receipt = await config.publicClient.waitForTransactionReceipt({ hash: ctxHash });
2742
2825
  const events = parseEventLogs({
2743
2826
  abi: confidentialWrapperAbi,
2744
2827
  logs: receipt.logs,
@@ -2756,43 +2839,43 @@ async function getTransferId(config, params) {
2756
2839
  }
2757
2840
 
2758
2841
  // src/actions/access.ts
2759
- import { encodeFunctionData as encodeFunctionData3, parseEventLogs as parseEventLogs2 } from "viem";
2760
- async function registerViewerKey(config, params) {
2761
- const { x, y } = parsePublicKeyCoordinates(params.publicKey);
2762
- const data = encodeFunctionData3({
2842
+ import { encodeFunctionData as encodeFunctionData2, parseEventLogs as parseEventLogs2 } from "viem";
2843
+ async function registerViewerKey(config, publicKey) {
2844
+ const { x, y } = parsePublicKeyCoordinates(publicKey);
2845
+ const data = encodeFunctionData2({
2763
2846
  abi: confidentialWrapperAbi,
2764
2847
  functionName: "setViewerPublicKey",
2765
2848
  args: [{ x, y }]
2766
2849
  });
2767
2850
  return config.signer.sendTransaction({ to: config.address, data });
2768
2851
  }
2769
- async function authorizeHistoricViewForRange(config, params) {
2770
- const data = encodeFunctionData3({
2852
+ async function authorizeHistoricViewForRange(config, address, fromTimestamp, toTimestamp) {
2853
+ const data = encodeFunctionData2({
2771
2854
  abi: confidentialWrapperAbi,
2772
2855
  functionName: "authorizeHistoricViewTimeRange",
2773
- args: [params.address, params.fromTimestamp, params.toTimestamp]
2856
+ args: [address, fromTimestamp, toTimestamp]
2774
2857
  });
2775
2858
  return config.signer.sendTransaction({ to: config.address, data });
2776
2859
  }
2777
- async function authorizeHistoricViewForTransfer(config, params) {
2778
- const data = encodeFunctionData3({
2860
+ async function authorizeHistoricViewForTransfer(config, address, transferId) {
2861
+ const data = encodeFunctionData2({
2779
2862
  abi: confidentialWrapperAbi,
2780
2863
  functionName: "authorizeHistoricViewTransferId",
2781
- args: [params.address, params.transferId]
2864
+ args: [address, transferId]
2782
2865
  });
2783
2866
  return config.signer.sendTransaction({ to: config.address, data });
2784
2867
  }
2785
- async function revokeHistoricView(config, params) {
2786
- const data = encodeFunctionData3({
2868
+ async function revokeHistoricView(config, address) {
2869
+ const data = encodeFunctionData2({
2787
2870
  abi: confidentialWrapperAbi,
2788
2871
  functionName: "removeHistoricViewAuth",
2789
- args: [params.address]
2872
+ args: [address]
2790
2873
  });
2791
2874
  return config.signer.sendTransaction({ to: config.address, data });
2792
2875
  }
2793
- async function requestTransferDecryption(config, params) {
2794
- const value = await getValueForCtx(config);
2795
- const receipt = await config.publicClient.waitForTransactionReceipt({ hash: params.ctxHash });
2876
+ async function requestTransferDecryption(config, ctxHash) {
2877
+ const value = await getCtxOperationCost(config);
2878
+ const receipt = await config.publicClient.waitForTransactionReceipt({ hash: ctxHash });
2796
2879
  const events = parseEventLogs2({
2797
2880
  abi: confidentialWrapperAbi,
2798
2881
  logs: receipt.logs,
@@ -2823,7 +2906,7 @@ async function requestTransferDecryption(config, params) {
2823
2906
  if (!canDecrypt) {
2824
2907
  throw new Error("Viewer is not authorized to decrypt this historic transfer.");
2825
2908
  }
2826
- const data = encodeFunctionData3({
2909
+ const data = encodeFunctionData2({
2827
2910
  abi: confidentialWrapperAbi,
2828
2911
  functionName: "requestDecryptHistoricTransferFor",
2829
2912
  args: [encryptedData, viewerAddress]
@@ -2834,15 +2917,13 @@ async function requestTransferDecryption(config, params) {
2834
2917
  export {
2835
2918
  confidentialWrapperAbi,
2836
2919
  getCtxBalance,
2837
- getCtxFee,
2838
- fundCtxBalance,
2839
- getValueForCtx,
2920
+ getCtxRawCost,
2921
+ getCtxOperationCost,
2840
2922
  approve,
2841
2923
  transfer,
2842
2924
  wrap,
2843
2925
  unwrap,
2844
2926
  decryptTokenBalance,
2845
- decryptHistoricTransferData,
2846
2927
  getTransferId,
2847
2928
  registerViewerKey,
2848
2929
  authorizeHistoricViewForRange,
@@ -2850,4 +2931,4 @@ export {
2850
2931
  revokeHistoricView,
2851
2932
  requestTransferDecryption
2852
2933
  };
2853
- //# sourceMappingURL=chunk-YEII26VS.js.map
2934
+ //# sourceMappingURL=chunk-PMT6KSGL.js.map