@relay-protocol/settlement-sdk 0.0.77 → 0.0.79
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/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { SolverRefundMessage, SolverRefundStatus, getSolverRefundMessageId } fro
|
|
|
5
5
|
import { SolverFillMessage, SolverFillStatus, getSolverFillMessageId } from "./messages/v2.1/solver-fill";
|
|
6
6
|
import { ActionType, ExecutionMessage, ExecutionMessageMetadata, getExecutionMessageId, encodeAction, decodeAction } from "./messages/v2.2/execution";
|
|
7
7
|
import { VmType, decodeAddress, decodeTransactionId, encodeAddress, encodeBytes, encodeTransactionId, getVmTypeNativeCurrency } from "./utils";
|
|
8
|
-
import { SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage } from "./messages/v2.2/withdrawal-execution";
|
|
8
|
+
import { SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest } from "./messages/v2.2/withdrawal-execution";
|
|
9
9
|
import { TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, getCheckSummedAddress, generateAddress, generateTokenId } from "./hub/hub-utils";
|
|
10
10
|
import type { NetworkConfig, NetworkConfigs, ProtocolContracts } from "./networks";
|
|
11
|
-
export { Order, encodeOrderCall, decodeOrderCall, encodeOrderExtraData, decodeOrderExtraData, getOrderId, VmType, decodeAddress, decodeTransactionId, encodeAddress, encodeBytes, encodeTransactionId, getVmTypeNativeCurrency, DepositoryDepositMessage, getDepositoryDepositMessageId, DecodedBitcoinVmWithdrawal, DecodedEthereumVmWithdrawal, DecodedSolanaVmWithdrawal, DecodedSuiVmWithdrawal, DecodedHyperliquidVmWithdrawal, DepositoryWithdrawalMessage, DepositoryWithdrawalStatus, getDepositoryWithdrawalMessageId, encodeWithdrawal, decodeWithdrawal, getDecodedWithdrawalId, getDecodedWithdrawalCurrency, getDecodedWithdrawalAmount, getDecodedWithdrawalRecipient, SolverRefundMessage, SolverRefundStatus, getSolverRefundMessageId, SolverFillMessage, SolverFillStatus, getSolverFillMessageId, ExecutionMessage, ExecutionMessageMetadata, ActionType, getExecutionMessageId, encodeAction, decodeAction, TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, getCheckSummedAddress, generateAddress, generateTokenId, SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage, NetworkConfigs, ProtocolContracts, NetworkConfig, };
|
|
11
|
+
export { Order, encodeOrderCall, decodeOrderCall, encodeOrderExtraData, decodeOrderExtraData, getOrderId, VmType, decodeAddress, decodeTransactionId, encodeAddress, encodeBytes, encodeTransactionId, getVmTypeNativeCurrency, DepositoryDepositMessage, getDepositoryDepositMessageId, DecodedBitcoinVmWithdrawal, DecodedEthereumVmWithdrawal, DecodedSolanaVmWithdrawal, DecodedSuiVmWithdrawal, DecodedHyperliquidVmWithdrawal, DepositoryWithdrawalMessage, DepositoryWithdrawalStatus, getDepositoryWithdrawalMessageId, encodeWithdrawal, decodeWithdrawal, getDecodedWithdrawalId, getDecodedWithdrawalCurrency, getDecodedWithdrawalAmount, getDecodedWithdrawalRecipient, SolverRefundMessage, SolverRefundStatus, getSolverRefundMessageId, SolverFillMessage, SolverFillStatus, getSolverFillMessageId, ExecutionMessage, ExecutionMessageMetadata, ActionType, getExecutionMessageId, encodeAction, decodeAction, TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, getCheckSummedAddress, generateAddress, generateTokenId, SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest, NetworkConfigs, ProtocolContracts, NetworkConfig, };
|
|
@@ -56,3 +56,50 @@ export type WithdrawalInitiatedMessage = {
|
|
|
56
56
|
withdrawalAddress: string;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export type OnChainWithdrawalQuery = {
|
|
60
|
+
data: {
|
|
61
|
+
chainId: string;
|
|
62
|
+
payloadId: string;
|
|
63
|
+
payloadParams: SubmitWithdrawRequest;
|
|
64
|
+
};
|
|
65
|
+
result: {
|
|
66
|
+
encodedData: string;
|
|
67
|
+
signature?: string;
|
|
68
|
+
signer?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type OnchainWithdrawalRequest = {
|
|
72
|
+
data: {
|
|
73
|
+
chainId: string;
|
|
74
|
+
currency: string;
|
|
75
|
+
amount: string;
|
|
76
|
+
recipient: string;
|
|
77
|
+
spender: string;
|
|
78
|
+
nonce: string;
|
|
79
|
+
additionalData?: {
|
|
80
|
+
"hyperliquid-vm"?: {
|
|
81
|
+
currencyHyperliquidSymbol: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
signature: string;
|
|
85
|
+
owner: string;
|
|
86
|
+
ownerChainId: string;
|
|
87
|
+
};
|
|
88
|
+
result: {
|
|
89
|
+
id: string;
|
|
90
|
+
encodedData: string;
|
|
91
|
+
payloadId: string;
|
|
92
|
+
submitWithdrawalRequestParams: SubmitWithdrawRequest;
|
|
93
|
+
signer: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type OnchainWithdrawalSignatureRequest = {
|
|
97
|
+
data: {
|
|
98
|
+
chainId: string;
|
|
99
|
+
payloadId: string;
|
|
100
|
+
payloadParams: SubmitWithdrawRequest;
|
|
101
|
+
};
|
|
102
|
+
result: {
|
|
103
|
+
message: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -5,32 +5,21 @@ exports.getWithdrawalAddress = getWithdrawalAddress;
|
|
|
5
5
|
exports.computeWithdrawerBalanceMessage = computeWithdrawerBalanceMessage;
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const getSubmitWithdrawRequestHash = (request) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]
|
|
22
|
-
|
|
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
|
/**
|
|
@@ -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", "
|
|
40
|
+
const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "uint256", "string", "string", "address", "bytes32"], [
|
|
52
41
|
withdrawalParams.depository,
|
|
53
42
|
withdrawalParams.depositoryChainId,
|
|
54
43
|
withdrawalParams.currency,
|