@relay-protocol/settlement-sdk 0.0.88 → 0.0.90

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
@@ -4,8 +4,9 @@ import { DecodedBitcoinVmWithdrawal, DecodedEthereumVmWithdrawal, DecodedSolanaV
4
4
  import { SolverRefundMessage, SolverRefundStatus, getSolverRefundMessageId } from "./messages/v2.1/solver-refund";
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
+ import { GenericMappingMessage, getGenericMappingMessageId } from "./messages/v2.2/generic-mapping";
8
+ import { SubmitWithdrawRequest, DenormalizedSubmitWithdrawRequest, getSubmitWithdrawRequestHash, WithdrawalAddressParams, getWithdrawalAddress, OrderAddressParams, getOrderAddress, normalizePayloadParams } from "./messages/v2.2/withdrawal";
7
9
  import { VmType, decodeAddress, decodeTransactionId, encodeAddress, encodeBytes, encodeTransactionId, getVmTypeNativeCurrency } from "./utils";
8
- import { SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, getOrderAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest, SubmitWithdrawRequestV2, DenormalizedSubmitWithdrawRequestV2, getSubmitWithdrawRequestHashV2, WithdrawalAddressParamsV2, getWithdrawalAddressV2, OrderAddressParamsV2, getOrderAddressV2, normalizePayloadParamsV2 } from "./messages/v2.2/withdrawal-execution";
9
10
  import { TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, generateAddress, generateTokenId } from "./hub/hub-utils";
10
11
  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, generateAddress, generateTokenId, SubmitWithdrawRequest, getSubmitWithdrawRequestHash, getWithdrawalAddress, getOrderAddress, WithdrawalAddressParams, WithdrawalInitiationMessage, WithdrawalInitiatedMessage, WithdrawalAddressRequest, computeWithdrawerBalanceMessage, OnChainWithdrawalQuery, OnchainWithdrawalSignatureRequest, OnchainWithdrawalRequest, SubmitWithdrawRequestV2, DenormalizedSubmitWithdrawRequestV2, getSubmitWithdrawRequestHashV2, WithdrawalAddressParamsV2, getWithdrawalAddressV2, OrderAddressParamsV2, getOrderAddressV2, normalizePayloadParamsV2, NetworkConfigs, ProtocolContracts, NetworkConfig, };
12
+ 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, GenericMappingMessage, getGenericMappingMessageId, SubmitWithdrawRequest, DenormalizedSubmitWithdrawRequest, getSubmitWithdrawRequestHash, WithdrawalAddressParams, getWithdrawalAddress, OrderAddressParams, getOrderAddress, normalizePayloadParams, TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, generateAddress, generateTokenId, NetworkConfigs, ProtocolContracts, NetworkConfig, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizePayloadParamsV2 = exports.getOrderAddressV2 = exports.getWithdrawalAddressV2 = exports.getSubmitWithdrawRequestHashV2 = exports.computeWithdrawerBalanceMessage = exports.getOrderAddress = exports.getWithdrawalAddress = exports.getSubmitWithdrawRequestHash = exports.generateTokenId = exports.generateAddress = exports.decodeAction = exports.encodeAction = exports.getExecutionMessageId = exports.ActionType = exports.getSolverFillMessageId = exports.SolverFillStatus = exports.getSolverRefundMessageId = exports.SolverRefundStatus = exports.getDecodedWithdrawalRecipient = exports.getDecodedWithdrawalAmount = exports.getDecodedWithdrawalCurrency = exports.getDecodedWithdrawalId = exports.decodeWithdrawal = exports.encodeWithdrawal = exports.getDepositoryWithdrawalMessageId = exports.DepositoryWithdrawalStatus = exports.getDepositoryDepositMessageId = exports.getVmTypeNativeCurrency = exports.encodeTransactionId = exports.encodeBytes = exports.encodeAddress = exports.decodeTransactionId = exports.decodeAddress = exports.getOrderId = exports.decodeOrderExtraData = exports.encodeOrderExtraData = exports.decodeOrderCall = exports.encodeOrderCall = void 0;
3
+ exports.generateTokenId = exports.generateAddress = exports.normalizePayloadParams = exports.getOrderAddress = exports.getWithdrawalAddress = exports.getSubmitWithdrawRequestHash = exports.getGenericMappingMessageId = exports.decodeAction = exports.encodeAction = exports.getExecutionMessageId = exports.ActionType = exports.getSolverFillMessageId = exports.SolverFillStatus = exports.getSolverRefundMessageId = exports.SolverRefundStatus = exports.getDecodedWithdrawalRecipient = exports.getDecodedWithdrawalAmount = exports.getDecodedWithdrawalCurrency = exports.getDecodedWithdrawalId = exports.decodeWithdrawal = exports.encodeWithdrawal = exports.getDepositoryWithdrawalMessageId = exports.DepositoryWithdrawalStatus = exports.getDepositoryDepositMessageId = exports.getVmTypeNativeCurrency = exports.encodeTransactionId = exports.encodeBytes = exports.encodeAddress = exports.decodeTransactionId = exports.decodeAddress = exports.getOrderId = exports.decodeOrderExtraData = exports.encodeOrderExtraData = exports.decodeOrderCall = exports.encodeOrderCall = void 0;
4
4
  const order_1 = require("./order");
5
5
  Object.defineProperty(exports, "encodeOrderCall", { enumerable: true, get: function () { return order_1.encodeOrderCall; } });
6
6
  Object.defineProperty(exports, "decodeOrderCall", { enumerable: true, get: function () { return order_1.decodeOrderCall; } });
@@ -29,6 +29,13 @@ Object.defineProperty(exports, "ActionType", { enumerable: true, get: function (
29
29
  Object.defineProperty(exports, "getExecutionMessageId", { enumerable: true, get: function () { return execution_1.getExecutionMessageId; } });
30
30
  Object.defineProperty(exports, "encodeAction", { enumerable: true, get: function () { return execution_1.encodeAction; } });
31
31
  Object.defineProperty(exports, "decodeAction", { enumerable: true, get: function () { return execution_1.decodeAction; } });
32
+ const generic_mapping_1 = require("./messages/v2.2/generic-mapping");
33
+ Object.defineProperty(exports, "getGenericMappingMessageId", { enumerable: true, get: function () { return generic_mapping_1.getGenericMappingMessageId; } });
34
+ const withdrawal_1 = require("./messages/v2.2/withdrawal");
35
+ Object.defineProperty(exports, "getSubmitWithdrawRequestHash", { enumerable: true, get: function () { return withdrawal_1.getSubmitWithdrawRequestHash; } });
36
+ Object.defineProperty(exports, "getWithdrawalAddress", { enumerable: true, get: function () { return withdrawal_1.getWithdrawalAddress; } });
37
+ Object.defineProperty(exports, "getOrderAddress", { enumerable: true, get: function () { return withdrawal_1.getOrderAddress; } });
38
+ Object.defineProperty(exports, "normalizePayloadParams", { enumerable: true, get: function () { return withdrawal_1.normalizePayloadParams; } });
32
39
  const utils_1 = require("./utils");
33
40
  Object.defineProperty(exports, "decodeAddress", { enumerable: true, get: function () { return utils_1.decodeAddress; } });
34
41
  Object.defineProperty(exports, "decodeTransactionId", { enumerable: true, get: function () { return utils_1.decodeTransactionId; } });
@@ -36,15 +43,6 @@ Object.defineProperty(exports, "encodeAddress", { enumerable: true, get: functio
36
43
  Object.defineProperty(exports, "encodeBytes", { enumerable: true, get: function () { return utils_1.encodeBytes; } });
37
44
  Object.defineProperty(exports, "encodeTransactionId", { enumerable: true, get: function () { return utils_1.encodeTransactionId; } });
38
45
  Object.defineProperty(exports, "getVmTypeNativeCurrency", { enumerable: true, get: function () { return utils_1.getVmTypeNativeCurrency; } });
39
- const withdrawal_execution_1 = require("./messages/v2.2/withdrawal-execution");
40
- Object.defineProperty(exports, "getSubmitWithdrawRequestHash", { enumerable: true, get: function () { return withdrawal_execution_1.getSubmitWithdrawRequestHash; } });
41
- Object.defineProperty(exports, "getWithdrawalAddress", { enumerable: true, get: function () { return withdrawal_execution_1.getWithdrawalAddress; } });
42
- Object.defineProperty(exports, "getOrderAddress", { enumerable: true, get: function () { return withdrawal_execution_1.getOrderAddress; } });
43
- Object.defineProperty(exports, "computeWithdrawerBalanceMessage", { enumerable: true, get: function () { return withdrawal_execution_1.computeWithdrawerBalanceMessage; } });
44
- Object.defineProperty(exports, "getSubmitWithdrawRequestHashV2", { enumerable: true, get: function () { return withdrawal_execution_1.getSubmitWithdrawRequestHashV2; } });
45
- Object.defineProperty(exports, "getWithdrawalAddressV2", { enumerable: true, get: function () { return withdrawal_execution_1.getWithdrawalAddressV2; } });
46
- Object.defineProperty(exports, "getOrderAddressV2", { enumerable: true, get: function () { return withdrawal_execution_1.getOrderAddressV2; } });
47
- Object.defineProperty(exports, "normalizePayloadParamsV2", { enumerable: true, get: function () { return withdrawal_execution_1.normalizePayloadParamsV2; } });
48
46
  const hub_utils_1 = require("./hub/hub-utils");
49
47
  Object.defineProperty(exports, "generateAddress", { enumerable: true, get: function () { return hub_utils_1.generateAddress; } });
50
48
  Object.defineProperty(exports, "generateTokenId", { enumerable: true, get: function () { return hub_utils_1.generateTokenId; } });
@@ -1,3 +1,4 @@
1
+ import { Address } from "viem";
1
2
  import { VmType } from "../../utils";
2
3
  export declare enum ActionType {
3
4
  MINT = 0,
@@ -12,7 +13,7 @@ export type ExecutionMessageMetadata = {
12
13
  family: VmType;
13
14
  };
14
15
  oracleChainId: string;
15
- oracleContract: `0x${string}`;
16
+ oracleContract: Address;
16
17
  };
17
18
  export type ExecutionMessage = {
18
19
  idempotencyKey: string;
@@ -0,0 +1,7 @@
1
+ export type GenericMappingMessage = {
2
+ user: string;
3
+ id: string;
4
+ data: string;
5
+ nonce: string;
6
+ };
7
+ export declare const getGenericMappingMessageId: (message: GenericMappingMessage) => `0x${string}`;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGenericMappingMessageId = void 0;
4
+ const viem_1 = require("viem");
5
+ const getGenericMappingMessageId = (message) => {
6
+ return (0, viem_1.hashStruct)({
7
+ types: {
8
+ SetEntry: [
9
+ { name: "user", type: "address" },
10
+ { name: "id", type: "bytes32" },
11
+ { name: "data", type: "bytes" },
12
+ { name: "nonce", type: "bytes32" },
13
+ ],
14
+ },
15
+ primaryType: "SetEntry",
16
+ data: {
17
+ user: message.user,
18
+ id: message.id,
19
+ data: message.data,
20
+ nonce: message.nonce,
21
+ },
22
+ });
23
+ };
24
+ exports.getGenericMappingMessageId = getGenericMappingMessageId;
@@ -0,0 +1,50 @@
1
+ import { Address } from "viem";
2
+ import { VmType } from "../../utils";
3
+ export interface SubmitWithdrawRequest {
4
+ chainId: string;
5
+ depository: string;
6
+ currency: string;
7
+ amount: string;
8
+ spender: string;
9
+ recipient: string;
10
+ nonce: string;
11
+ data: string;
12
+ }
13
+ export type DenormalizedSubmitWithdrawRequest = Omit<SubmitWithdrawRequest, "data"> & {
14
+ additionalData?: {
15
+ "bitcoin-vm"?: {
16
+ allocatorUtxos: {
17
+ txid: string;
18
+ vout: number;
19
+ value: string;
20
+ }[];
21
+ feeRate: number;
22
+ };
23
+ "hyperliquid-vm"?: {
24
+ currencyHyperliquidSymbol: string;
25
+ currentTime: number;
26
+ };
27
+ };
28
+ };
29
+ export declare const getSubmitWithdrawRequestHash: (request: SubmitWithdrawRequest) => `0x${string}`;
30
+ export type WithdrawalAddressParams = {
31
+ vmType: VmType;
32
+ chainId: string;
33
+ depository: string;
34
+ currency: string;
35
+ recipient: string;
36
+ ownerAlias: string;
37
+ nonce: string;
38
+ };
39
+ export declare function getWithdrawalAddress(withdrawalParams: WithdrawalAddressParams): Address;
40
+ export type OrderAddressParams = {
41
+ vmType: VmType;
42
+ chainId: string;
43
+ depositor: string;
44
+ timestamp: bigint;
45
+ depositId: string;
46
+ };
47
+ export declare function getOrderAddress(orderParams: OrderAddressParams): Address;
48
+ export declare function normalizePayloadParams(request: DenormalizedSubmitWithdrawRequest & {
49
+ vmType: VmType;
50
+ }): SubmitWithdrawRequest;
@@ -36,13 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getSubmitWithdrawRequestHashV2 = exports.getSubmitWithdrawRequestHash = void 0;
39
+ exports.getSubmitWithdrawRequestHash = void 0;
40
40
  exports.getWithdrawalAddress = getWithdrawalAddress;
41
41
  exports.getOrderAddress = getOrderAddress;
42
- exports.computeWithdrawerBalanceMessage = computeWithdrawerBalanceMessage;
43
- exports.getWithdrawalAddressV2 = getWithdrawalAddressV2;
44
- exports.getOrderAddressV2 = getOrderAddressV2;
45
- exports.normalizePayloadParamsV2 = normalizePayloadParamsV2;
42
+ exports.normalizePayloadParams = normalizePayloadParams;
46
43
  const web3_js_1 = require("@solana/web3.js");
47
44
  const bitcoin = __importStar(require("bitcoinjs-lib"));
48
45
  const tronweb_1 = __importDefault(require("tronweb"));
@@ -59,7 +56,7 @@ const getSubmitWithdrawRequestHash = (request) => {
59
56
  currency: request.currency,
60
57
  amount: BigInt(request.amount),
61
58
  spender: request.spender,
62
- receiver: request.receiver,
59
+ receiver: request.recipient,
63
60
  data: request.data,
64
61
  nonce: request.nonce,
65
62
  },
@@ -67,69 +64,7 @@ const getSubmitWithdrawRequestHash = (request) => {
67
64
  return (0, viem_1.keccak256)(encoded);
68
65
  };
69
66
  exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
70
- /**
71
- * Compute deterministic withdrawal address
72
- *
73
- * @param depository the depository contract holding the funds on origin chain (as string)
74
- * @param depositoryChainId the chain id of the depository contract currently holding the funds
75
- * @param currency the id of the currency as expressed on origin chain (string)
76
- * @param recipient the address that will receive the withdrawn funds on destination chain
77
- * @param withdrawerAlias the address that owns the balance on the settlement chain
78
- * before the withdrawal is initiated
79
- * @param withdrawalNonce nonce to prevent collisions for similar withdrawals
80
- * @returns withdrawal address (in lower case)
81
- */
82
67
  function getWithdrawalAddress(withdrawalParams) {
83
- const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "bytes", "bytes", "bytes", "address", "bytes32"], [
84
- withdrawalParams.depositoryChainId,
85
- (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(withdrawalParams.depository, withdrawalParams.depositoryVmType)),
86
- (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(withdrawalParams.currency, withdrawalParams.depositoryVmType)),
87
- (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(withdrawalParams.recipient, withdrawalParams.depositoryVmType)),
88
- withdrawalParams.withdrawerAlias,
89
- `0x${BigInt(withdrawalParams.withdrawalNonce).toString(16).padStart(64, "0")}`,
90
- ]));
91
- // get 40 bytes for an address
92
- const withdrawalAddress = hash.slice(2).slice(-40).toLowerCase();
93
- return `0x${withdrawalAddress}`;
94
- }
95
- function getOrderAddress(data) {
96
- const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "bytes", "uint256", "bytes32"], [
97
- data.depositChainId,
98
- (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(data.depositor, data.depositChainVmType)),
99
- BigInt(data.depositTimestamp),
100
- data.depositId,
101
- ]));
102
- const orderAddress = hash.slice(2).slice(-40);
103
- return `0x${orderAddress}`;
104
- }
105
- // compute a message about withdrawer balance
106
- // to be signed as auth proof for the oracle
107
- function computeWithdrawerBalanceMessage(withdrawerAlias, amount, withdrawalNonce) {
108
- return (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "bytes32"], [
109
- withdrawerAlias,
110
- BigInt(amount),
111
- withdrawalNonce,
112
- ]));
113
- }
114
- const getSubmitWithdrawRequestHashV2 = (request) => {
115
- const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)([
116
- "(uint256 chainId, string depository, string currency, uint256 amount, address spender, string receiver, bytes data, bytes32 nonce)",
117
- ]), [
118
- {
119
- chainId: BigInt(request.chainId),
120
- depository: request.depository,
121
- currency: request.currency,
122
- amount: BigInt(request.amount),
123
- spender: request.spender,
124
- receiver: request.recipient,
125
- data: request.data,
126
- nonce: request.nonce,
127
- },
128
- ]);
129
- return (0, viem_1.keccak256)(encoded);
130
- };
131
- exports.getSubmitWithdrawRequestHashV2 = getSubmitWithdrawRequestHashV2;
132
- function getWithdrawalAddressV2(withdrawalParams) {
133
68
  const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "bytes", "bytes", "bytes", "address", "bytes32"], [
134
69
  withdrawalParams.chainId,
135
70
  (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(withdrawalParams.depository, withdrawalParams.vmType)),
@@ -142,7 +77,7 @@ function getWithdrawalAddressV2(withdrawalParams) {
142
77
  const withdrawalAddress = hash.slice(2).slice(-40).toLowerCase();
143
78
  return `0x${withdrawalAddress}`;
144
79
  }
145
- function getOrderAddressV2(orderParams) {
80
+ function getOrderAddress(orderParams) {
146
81
  const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "bytes", "uint256", "bytes32"], [
147
82
  orderParams.chainId,
148
83
  (0, hub_utils_1.arrayToHex)((0, utils_1.encodeAddress)(orderParams.depositor, orderParams.vmType)),
@@ -153,7 +88,7 @@ function getOrderAddressV2(orderParams) {
153
88
  const orderAddress = hash.slice(2).slice(-40);
154
89
  return `0x${orderAddress}`;
155
90
  }
156
- function normalizePayloadParamsV2(request) {
91
+ function normalizePayloadParams(request) {
157
92
  const defaultParams = {
158
93
  chainId: request.chainId,
159
94
  depository: request.depository,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relay-protocol/settlement-sdk",
3
- "version": "0.0.88",
3
+ "version": "0.0.90",
4
4
  "description": "Relay protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,164 +0,0 @@
1
- import { Address } from "viem";
2
- import { VmType } from "../../utils";
3
- export interface SubmitWithdrawRequest {
4
- chainId: string;
5
- depository: string;
6
- currency: string;
7
- amount: string;
8
- spender: string;
9
- receiver: string;
10
- data: string;
11
- nonce: string;
12
- }
13
- export declare const getSubmitWithdrawRequestHash: (request: SubmitWithdrawRequest) => `0x${string}`;
14
- export type WithdrawalAddressParams = {
15
- depository: string;
16
- depositoryChainId: string;
17
- currency: string;
18
- recipient: string;
19
- withdrawerAlias: string;
20
- withdrawalNonce: string;
21
- };
22
- /**
23
- * Compute deterministic withdrawal address
24
- *
25
- * @param depository the depository contract holding the funds on origin chain (as string)
26
- * @param depositoryChainId the chain id of the depository contract currently holding the funds
27
- * @param currency the id of the currency as expressed on origin chain (string)
28
- * @param recipient the address that will receive the withdrawn funds on destination chain
29
- * @param withdrawerAlias the address that owns the balance on the settlement chain
30
- * before the withdrawal is initiated
31
- * @param withdrawalNonce nonce to prevent collisions for similar withdrawals
32
- * @returns withdrawal address (in lower case)
33
- */
34
- export declare function getWithdrawalAddress(withdrawalParams: WithdrawalAddressParams & {
35
- depositoryVmType: VmType;
36
- }): string;
37
- export declare function getOrderAddress(data: {
38
- depositChainVmType: VmType;
39
- depositChainId: string;
40
- depositor: string;
41
- depositTimestamp: bigint;
42
- depositId: string;
43
- }): string;
44
- export declare function computeWithdrawerBalanceMessage(withdrawerAlias: string, amount: bigint, withdrawalNonce: string): `0x${string}`;
45
- export type WithdrawalAddressRequest = Omit<WithdrawalAddressParams, "depositoryChainId" | "amount" | "depository" | "withdrawerAlias"> & {
46
- withdrawer: string;
47
- withdrawerChainId: string;
48
- chainId: string;
49
- };
50
- export type WithdrawalInitiationMessage = {
51
- data: WithdrawalAddressRequest & {
52
- expectedAmount: string;
53
- settlementChainId: string;
54
- signature: string;
55
- };
56
- result: {
57
- withdrawalAddress: string;
58
- };
59
- };
60
- export type WithdrawalInitiatedMessage = {
61
- data: WithdrawalAddressRequest & {
62
- expectedAmount: string;
63
- settlementChainId: string;
64
- };
65
- result: {
66
- proofOfWithdrawalAddressBalance: string;
67
- withdrawalAddress: string;
68
- };
69
- };
70
- export type OnChainWithdrawalQuery = {
71
- data: {
72
- chainId: string;
73
- payloadId: string;
74
- payloadParams: SubmitWithdrawRequest;
75
- };
76
- result: {
77
- encodedData: string;
78
- signature?: string;
79
- signer?: string;
80
- };
81
- };
82
- export type OnchainWithdrawalRequest = {
83
- data: {
84
- chainId: string;
85
- currency: string;
86
- amount: string;
87
- recipient: string;
88
- spender: string;
89
- nonce: string;
90
- additionalData?: {
91
- "hyperliquid-vm"?: {
92
- currencyHyperliquidSymbol: string;
93
- };
94
- };
95
- signature: string;
96
- owner: string;
97
- ownerChainId: string;
98
- };
99
- result: {
100
- id: string;
101
- encodedData: string;
102
- payloadId: string;
103
- submitWithdrawalRequestParams: SubmitWithdrawRequest;
104
- signer: string;
105
- };
106
- };
107
- export type OnchainWithdrawalSignatureRequest = {
108
- data: {
109
- chainId: string;
110
- payloadId: string;
111
- payloadParams: SubmitWithdrawRequest;
112
- };
113
- result: {
114
- message: string;
115
- };
116
- };
117
- export interface SubmitWithdrawRequestV2 {
118
- chainId: string;
119
- depository: string;
120
- currency: string;
121
- amount: string;
122
- spender: string;
123
- recipient: string;
124
- nonce: string;
125
- data: string;
126
- }
127
- export type DenormalizedSubmitWithdrawRequestV2 = Omit<SubmitWithdrawRequestV2, "data"> & {
128
- additionalData?: {
129
- "bitcoin-vm"?: {
130
- allocatorUtxos: {
131
- txid: string;
132
- vout: number;
133
- value: string;
134
- }[];
135
- feeRate: number;
136
- };
137
- "hyperliquid-vm"?: {
138
- currencyHyperliquidSymbol: string;
139
- currentTime: number;
140
- };
141
- };
142
- };
143
- export declare const getSubmitWithdrawRequestHashV2: (request: SubmitWithdrawRequestV2) => `0x${string}`;
144
- export type WithdrawalAddressParamsV2 = {
145
- vmType: VmType;
146
- chainId: string;
147
- depository: string;
148
- currency: string;
149
- recipient: string;
150
- ownerAlias: string;
151
- nonce: string;
152
- };
153
- export declare function getWithdrawalAddressV2(withdrawalParams: WithdrawalAddressParamsV2): Address;
154
- export type OrderAddressParamsV2 = {
155
- vmType: VmType;
156
- chainId: string;
157
- depositor: string;
158
- timestamp: bigint;
159
- depositId: string;
160
- };
161
- export declare function getOrderAddressV2(orderParams: OrderAddressParamsV2): Address;
162
- export declare function normalizePayloadParamsV2(request: DenormalizedSubmitWithdrawRequestV2 & {
163
- vmType: VmType;
164
- }): SubmitWithdrawRequestV2;