@relay-protocol/settlement-sdk 0.0.69 → 0.0.71

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.
@@ -15,7 +15,6 @@ export type WithdrawalAddressParams = {
15
15
  currency: string;
16
16
  recipient: string;
17
17
  withdrawerAlias: string;
18
- amount: bigint;
19
18
  withdrawalNonce: string;
20
19
  };
21
20
  /**
@@ -27,12 +26,11 @@ export type WithdrawalAddressParams = {
27
26
  * @param recipient the address that will receive the withdrawn funds on destination chain
28
27
  * @param withdrawerAlias the address that owns the balance on the settlement chain
29
28
  * before the withdrawal is initiated
30
- * @param amount the balance to withdraw
31
29
  * @param withdrawalNonce nonce to prevent collisions for similar withdrawals
32
30
  * @returns withdrawal address (in lower case)
33
31
  */
34
32
  export declare function getWithdrawalAddress(withdrawalParams: WithdrawalAddressParams): string;
35
- export declare function computeWithdrawerBalanceMessage(withdrawerAlias: string, amount: bigint, withdrawalNonce: string): void;
33
+ export declare function computeWithdrawerBalanceMessage(withdrawerAlias: string, amount: bigint, withdrawalNonce: string): `0x${string}`;
36
34
  export type WithdrawalAddressRequest = Omit<WithdrawalAddressParams, "depositoryChainId" | "amount" | "depository" | "withdrawerAlias"> & {
37
35
  withdrawer: string;
38
36
  withdrawerChainId: string;
@@ -42,36 +42,28 @@ exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
42
42
  * @param recipient the address that will receive the withdrawn funds on destination chain
43
43
  * @param withdrawerAlias the address that owns the balance on the settlement chain
44
44
  * before the withdrawal is initiated
45
- * @param amount the balance to withdraw
46
45
  * @param withdrawalNonce nonce to prevent collisions for similar withdrawals
47
46
  * @returns withdrawal address (in lower case)
48
47
  */
49
48
  function getWithdrawalAddress(withdrawalParams) {
50
49
  // pack and hash data
51
50
  const nonce = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string"], [withdrawalParams.withdrawalNonce]));
52
- const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)([
53
- "address",
54
- "uint256",
55
- "string",
56
- "address",
57
- "address",
58
- "uint256",
59
- "bytes32",
60
- ], [
51
+ const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "string", "address", "address", "bytes32"], [
61
52
  withdrawalParams.depository,
62
53
  withdrawalParams.depositoryChainId,
63
54
  withdrawalParams.currency,
64
55
  withdrawalParams.recipient,
65
56
  withdrawalParams.withdrawerAlias,
66
- withdrawalParams.amount,
67
57
  nonce,
68
58
  ]));
69
59
  // get 40 bytes for an address
70
60
  const withdrawalAddress = hash.slice(2).slice(-40).toLowerCase();
71
61
  return `0x${withdrawalAddress}`;
72
62
  }
63
+ // compute a message about withdrawer balance
64
+ // to be signed as auth proof for the oracle
73
65
  function computeWithdrawerBalanceMessage(withdrawerAlias, amount, withdrawalNonce) {
74
- (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "bytes32"], [
66
+ return (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "bytes32"], [
75
67
  withdrawerAlias,
76
68
  BigInt(amount),
77
69
  withdrawalNonce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relay-protocol/settlement-sdk",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "description": "Relay protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",