@relay-protocol/settlement-sdk 0.0.79 → 0.0.80

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, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest } from "./messages/v2.2/withdrawal-execution";
8
+ import { SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage } 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, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest, 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, NetworkConfigs, ProtocolContracts, NetworkConfig, };
@@ -74,7 +74,7 @@ const encodeAction = (action) => {
74
74
  };
75
75
  exports.encodeAction = encodeAction;
76
76
  const decodeAction = (action) => {
77
- // decode just the uint8 type
77
+ // Decode just the uint8 type
78
78
  const [type] = (0, viem_1.decodeAbiParameters)((0, viem_1.parseAbiParameters)(["uint8 type"]), action);
79
79
  switch (type) {
80
80
  case ActionType.MINT: {
@@ -30,16 +30,18 @@ export type WithdrawalAddressParams = {
30
30
  * @returns withdrawal address (in lower case)
31
31
  */
32
32
  export declare function getWithdrawalAddress(withdrawalParams: WithdrawalAddressParams): string;
33
- export declare function computeWithdrawerBalanceMessage(withdrawerAlias: string, amount: bigint, withdrawalNonce: string): `0x${string}`;
34
- export type WithdrawalAddressRequest = Omit<WithdrawalAddressParams, "depositoryChainId" | "amount" | "depository" | "withdrawerAlias"> & {
35
- withdrawer: string;
36
- withdrawerChainId: string;
33
+ export declare const computeWithdrawerBalanceMessage: (withdrawerAlias: string, amount: bigint, withdrawalNonce: string) => `0x${string}`;
34
+ export type WithdrawalAddressRequest = {
37
35
  chainId: string;
36
+ currency: string;
37
+ recipient: string;
38
+ withdrawerChainId: string;
39
+ withdrawer: string;
40
+ withdrawalNonce: string;
38
41
  };
39
42
  export type WithdrawalInitiationMessage = {
40
43
  data: WithdrawalAddressRequest & {
41
- expectedAmount: string;
42
- settlementChainId: string;
44
+ amount: string;
43
45
  signature: string;
44
46
  };
45
47
  result: {
@@ -48,58 +50,10 @@ export type WithdrawalInitiationMessage = {
48
50
  };
49
51
  export type WithdrawalInitiatedMessage = {
50
52
  data: WithdrawalAddressRequest & {
51
- expectedAmount: string;
52
- settlementChainId: string;
53
+ amount: string;
53
54
  };
54
55
  result: {
55
56
  proofOfWithdrawalAddressBalance: string;
56
57
  withdrawalAddress: string;
57
58
  };
58
59
  };
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
- };
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSubmitWithdrawRequestHash = void 0;
3
+ exports.computeWithdrawerBalanceMessage = exports.getSubmitWithdrawRequestHash = void 0;
4
4
  exports.getWithdrawalAddress = getWithdrawalAddress;
5
- exports.computeWithdrawerBalanceMessage = computeWithdrawerBalanceMessage;
6
5
  const viem_1 = require("viem");
7
6
  const getSubmitWithdrawRequestHash = (request) => {
8
7
  const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)([
@@ -35,7 +34,7 @@ exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
35
34
  * @returns withdrawal address (in lower case)
36
35
  */
37
36
  function getWithdrawalAddress(withdrawalParams) {
38
- // pack and hash data
37
+ // Pack and hash data
39
38
  const nonce = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string"], [withdrawalParams.withdrawalNonce]));
40
39
  const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "uint256", "string", "string", "address", "bytes32"], [
41
40
  withdrawalParams.depository,
@@ -45,16 +44,16 @@ function getWithdrawalAddress(withdrawalParams) {
45
44
  withdrawalParams.withdrawerAlias,
46
45
  nonce,
47
46
  ]));
48
- // get 40 bytes for an address
47
+ // Get the first 40 bytes for an address
49
48
  const withdrawalAddress = hash.slice(2).slice(-40).toLowerCase();
50
49
  return `0x${withdrawalAddress}`;
51
50
  }
52
- // compute a message about withdrawer balance
53
- // to be signed as auth proof for the oracle
54
- function computeWithdrawerBalanceMessage(withdrawerAlias, amount, withdrawalNonce) {
51
+ // Compute a message about withdrawer balance to be signed as auth proof for the oracle
52
+ const computeWithdrawerBalanceMessage = (withdrawerAlias, amount, withdrawalNonce) => {
55
53
  return (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "bytes32"], [
56
54
  withdrawerAlias,
57
55
  BigInt(amount),
58
56
  withdrawalNonce,
59
57
  ]));
60
- }
58
+ };
59
+ exports.computeWithdrawerBalanceMessage = computeWithdrawerBalanceMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relay-protocol/settlement-sdk",
3
- "version": "0.0.79",
3
+ "version": "0.0.80",
4
4
  "description": "Relay protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",