@relay-protocol/settlement-sdk 0.0.73 → 0.0.74

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.
@@ -20,7 +20,7 @@ export type WithdrawalAddressParams = {
20
20
  /**
21
21
  * Compute deterministic withdrawal address
22
22
  *
23
- * @param depository the depository contract holding the funds on origin chain (as string)
23
+ * @param depository the depository contract holding the funds on origin chain
24
24
  * @param depositoryChainId the chain id of the depository contract currently holding the funds
25
25
  * @param currency the id of the currency as expressed on origin chain (string)
26
26
  * @param recipient the address that will receive the withdrawn funds on destination chain
@@ -38,7 +38,6 @@ export type WithdrawalAddressRequest = Omit<WithdrawalAddressParams, "depository
38
38
  };
39
39
  export type WithdrawalInitiationMessage = {
40
40
  data: WithdrawalAddressRequest & {
41
- expectedAmount: string;
42
41
  settlementChainId: string;
43
42
  signature: string;
44
43
  };
@@ -48,7 +47,6 @@ export type WithdrawalInitiationMessage = {
48
47
  };
49
48
  export type WithdrawalInitiatedMessage = {
50
49
  data: WithdrawalAddressRequest & {
51
- expectedAmount: string;
52
50
  settlementChainId: string;
53
51
  };
54
52
  result: {
@@ -56,3 +54,52 @@ export type WithdrawalInitiatedMessage = {
56
54
  withdrawalAddress: string;
57
55
  };
58
56
  };
57
+ export type OnChainWithdrawalQuery = {
58
+ data: {
59
+ chainId: string;
60
+ payloadId: string;
61
+ payloadParams: SubmitWithdrawRequest;
62
+ };
63
+ result: {
64
+ encodedData: string;
65
+ signature?: string;
66
+ signer?: string;
67
+ };
68
+ };
69
+ export type OnchainWithdrawalRequest = {
70
+ data: {
71
+ chainId: string;
72
+ currency: string;
73
+ amount: string;
74
+ recipient: string;
75
+ spender: string;
76
+ nonce: string;
77
+ additionalData?: {
78
+ "hyperliquid-vm"?: {
79
+ currencyHyperliquidSymbol: string;
80
+ };
81
+ };
82
+ signature: string;
83
+ owner: string;
84
+ ownerChainId: string;
85
+ };
86
+ result: {
87
+ id: string;
88
+ encodedData: string;
89
+ payloadId: string;
90
+ submitWithdrawalRequestParams: SubmitWithdrawRequest;
91
+ signer: string;
92
+ };
93
+ };
94
+ export type OnchainWithdrawalSignatureRequest = {
95
+ data: {
96
+ chainId: string;
97
+ payloadId: string;
98
+ payloadParams: SubmitWithdrawRequest;
99
+ };
100
+ result: {
101
+ encodedData: string;
102
+ signer: string;
103
+ signature?: string;
104
+ };
105
+ };
@@ -5,38 +5,27 @@ exports.getWithdrawalAddress = getWithdrawalAddress;
5
5
  exports.computeWithdrawerBalanceMessage = computeWithdrawerBalanceMessage;
6
6
  const viem_1 = require("viem");
7
7
  const getSubmitWithdrawRequestHash = (request) => {
8
- // EIP712 type from RelayAllocator
9
- const PAYLOAD_TYPEHASH = (0, viem_1.keccak256)("SubmitWithdrawRequest(uint256 chainId,string depository,string currency,uint256 amount,address spender,string receiver,bytes data,bytes32 nonce)");
10
- // Create EIP712 digest
11
- const digest = (0, viem_1.keccak256)((0, viem_1.encodePacked)([
12
- "bytes32",
13
- "uint256",
14
- "bytes32",
15
- "bytes32",
16
- "uint256",
17
- "address",
18
- "bytes32",
19
- "bytes32",
20
- "bytes32",
21
- ], [
22
- PAYLOAD_TYPEHASH,
23
- BigInt(request.chainId),
24
- (0, viem_1.keccak256)(request.depository),
25
- (0, viem_1.keccak256)(request.currency),
26
- BigInt(request.amount),
27
- request.spender,
28
- (0, viem_1.keccak256)(request.receiver),
29
- (0, viem_1.keccak256)(request.data),
30
- request.nonce,
31
- ]));
32
- // The withdrawal address is the digest itself (as a hex string)
33
- return digest;
8
+ const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)([
9
+ "(uint256 chainId, string depository, string currency, uint256 amount, address spender, string receiver, bytes data, bytes32 nonce)",
10
+ ]), [
11
+ {
12
+ chainId: BigInt(request.chainId),
13
+ depository: request.depository,
14
+ currency: request.currency,
15
+ amount: BigInt(request.amount),
16
+ spender: request.spender,
17
+ receiver: request.receiver,
18
+ data: request.data,
19
+ nonce: request.nonce,
20
+ },
21
+ ]);
22
+ return (0, viem_1.keccak256)(encoded);
34
23
  };
35
24
  exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
36
25
  /**
37
26
  * Compute deterministic withdrawal address
38
27
  *
39
- * @param depository the depository contract holding the funds on origin chain (as string)
28
+ * @param depository the depository contract holding the funds on origin chain
40
29
  * @param depositoryChainId the chain id of the depository contract currently holding the funds
41
30
  * @param currency the id of the currency as expressed on origin chain (string)
42
31
  * @param recipient the address that will receive the withdrawn funds on destination chain
@@ -48,7 +37,7 @@ exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
48
37
  function getWithdrawalAddress(withdrawalParams) {
49
38
  // pack and hash data
50
39
  const nonce = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string"], [withdrawalParams.withdrawalNonce]));
51
- const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "uint256", "string", "address", "address", "bytes32"], [
40
+ const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "string", "address", "address", "bytes32"], [
52
41
  withdrawalParams.depository,
53
42
  withdrawalParams.depositoryChainId,
54
43
  withdrawalParams.currency,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relay-protocol/settlement-sdk",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "description": "Relay protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",