@relay-protocol/settlement-sdk 0.0.87 → 0.0.89
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 {
|
|
8
|
+
import { SubmitWithdrawRequest, DenormalizedSubmitWithdrawRequest, getSubmitWithdrawRequestHash, WithdrawalAddressParams, getWithdrawalAddress, OrderAddressParams, getOrderAddress, normalizePayloadParams } from "./messages/v2.2/withdrawal";
|
|
9
9
|
import { TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, 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,
|
|
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, 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.
|
|
3
|
+
exports.generateTokenId = exports.generateAddress = exports.normalizePayloadParams = exports.getOrderAddress = exports.getWithdrawalAddress = exports.getSubmitWithdrawRequestHash = 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; } });
|
|
@@ -36,11 +36,11 @@ Object.defineProperty(exports, "encodeAddress", { enumerable: true, get: functio
|
|
|
36
36
|
Object.defineProperty(exports, "encodeBytes", { enumerable: true, get: function () { return utils_1.encodeBytes; } });
|
|
37
37
|
Object.defineProperty(exports, "encodeTransactionId", { enumerable: true, get: function () { return utils_1.encodeTransactionId; } });
|
|
38
38
|
Object.defineProperty(exports, "getVmTypeNativeCurrency", { enumerable: true, get: function () { return utils_1.getVmTypeNativeCurrency; } });
|
|
39
|
-
const
|
|
40
|
-
Object.defineProperty(exports, "getSubmitWithdrawRequestHash", { enumerable: true, get: function () { return
|
|
41
|
-
Object.defineProperty(exports, "getWithdrawalAddress", { enumerable: true, get: function () { return
|
|
42
|
-
Object.defineProperty(exports, "getOrderAddress", { enumerable: true, get: function () { return
|
|
43
|
-
Object.defineProperty(exports, "normalizePayloadParams", { enumerable: true, get: function () { return
|
|
39
|
+
const withdrawal_1 = require("./messages/v2.2/withdrawal");
|
|
40
|
+
Object.defineProperty(exports, "getSubmitWithdrawRequestHash", { enumerable: true, get: function () { return withdrawal_1.getSubmitWithdrawRequestHash; } });
|
|
41
|
+
Object.defineProperty(exports, "getWithdrawalAddress", { enumerable: true, get: function () { return withdrawal_1.getWithdrawalAddress; } });
|
|
42
|
+
Object.defineProperty(exports, "getOrderAddress", { enumerable: true, get: function () { return withdrawal_1.getOrderAddress; } });
|
|
43
|
+
Object.defineProperty(exports, "normalizePayloadParams", { enumerable: true, get: function () { return withdrawal_1.normalizePayloadParams; } });
|
|
44
44
|
const hub_utils_1 = require("./hub/hub-utils");
|
|
45
45
|
Object.defineProperty(exports, "generateAddress", { enumerable: true, get: function () { return hub_utils_1.generateAddress; } });
|
|
46
46
|
Object.defineProperty(exports, "generateTokenId", { enumerable: true, get: function () { return hub_utils_1.generateTokenId; } });
|
|
@@ -36,18 +36,6 @@ export type WithdrawalAddressParams = {
|
|
|
36
36
|
ownerAlias: string;
|
|
37
37
|
nonce: string;
|
|
38
38
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Compute deterministic withdrawal address
|
|
41
|
-
*
|
|
42
|
-
* @param vmType the vm type of the depository chain
|
|
43
|
-
* @param chainId the chain id of the depository contract currently holding the funds
|
|
44
|
-
* @param depository the depository contract holding the funds on origin chain (as string)
|
|
45
|
-
* @param currency the id of the currency as expressed on origin chain (string)
|
|
46
|
-
* @param recipient the address that will receive the withdrawn funds on destination chain
|
|
47
|
-
* @param ownerAlias the address that owns the balance on the settlement chain before the withdrawal is initiated
|
|
48
|
-
* @param nonce nonce to prevent collisions for similar withdrawals
|
|
49
|
-
* @returns withdrawal address (in lower case)
|
|
50
|
-
*/
|
|
51
39
|
export declare function getWithdrawalAddress(withdrawalParams: WithdrawalAddressParams): Address;
|
|
52
40
|
export type OrderAddressParams = {
|
|
53
41
|
vmType: VmType;
|
|
@@ -57,7 +45,6 @@ export type OrderAddressParams = {
|
|
|
57
45
|
depositId: string;
|
|
58
46
|
};
|
|
59
47
|
export declare function getOrderAddress(orderParams: OrderAddressParams): Address;
|
|
60
|
-
export declare function getWithdrawalInitiationHash(withdrawerAlias: string, amount: bigint, withdrawalNonce: string): `0x${string}`;
|
|
61
48
|
export declare function normalizePayloadParams(request: DenormalizedSubmitWithdrawRequest & {
|
|
62
49
|
vmType: VmType;
|
|
63
50
|
}): SubmitWithdrawRequest;
|
|
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getSubmitWithdrawRequestHash = void 0;
|
|
40
40
|
exports.getWithdrawalAddress = getWithdrawalAddress;
|
|
41
41
|
exports.getOrderAddress = getOrderAddress;
|
|
42
|
-
exports.getWithdrawalInitiationHash = getWithdrawalInitiationHash;
|
|
43
42
|
exports.normalizePayloadParams = normalizePayloadParams;
|
|
44
43
|
const web3_js_1 = require("@solana/web3.js");
|
|
45
44
|
const bitcoin = __importStar(require("bitcoinjs-lib"));
|
|
@@ -65,18 +64,6 @@ const getSubmitWithdrawRequestHash = (request) => {
|
|
|
65
64
|
return (0, viem_1.keccak256)(encoded);
|
|
66
65
|
};
|
|
67
66
|
exports.getSubmitWithdrawRequestHash = getSubmitWithdrawRequestHash;
|
|
68
|
-
/**
|
|
69
|
-
* Compute deterministic withdrawal address
|
|
70
|
-
*
|
|
71
|
-
* @param vmType the vm type of the depository chain
|
|
72
|
-
* @param chainId the chain id of the depository contract currently holding the funds
|
|
73
|
-
* @param depository the depository contract holding the funds on origin chain (as string)
|
|
74
|
-
* @param currency the id of the currency as expressed on origin chain (string)
|
|
75
|
-
* @param recipient the address that will receive the withdrawn funds on destination chain
|
|
76
|
-
* @param ownerAlias the address that owns the balance on the settlement chain before the withdrawal is initiated
|
|
77
|
-
* @param nonce nonce to prevent collisions for similar withdrawals
|
|
78
|
-
* @returns withdrawal address (in lower case)
|
|
79
|
-
*/
|
|
80
67
|
function getWithdrawalAddress(withdrawalParams) {
|
|
81
68
|
const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(["string", "bytes", "bytes", "bytes", "address", "bytes32"], [
|
|
82
69
|
withdrawalParams.chainId,
|
|
@@ -101,13 +88,6 @@ function getOrderAddress(orderParams) {
|
|
|
101
88
|
const orderAddress = hash.slice(2).slice(-40);
|
|
102
89
|
return `0x${orderAddress}`;
|
|
103
90
|
}
|
|
104
|
-
function getWithdrawalInitiationHash(withdrawerAlias, amount, withdrawalNonce) {
|
|
105
|
-
return (0, viem_1.keccak256)((0, viem_1.encodePacked)(["address", "uint256", "bytes32"], [
|
|
106
|
-
withdrawerAlias,
|
|
107
|
-
BigInt(amount),
|
|
108
|
-
withdrawalNonce,
|
|
109
|
-
]));
|
|
110
|
-
}
|
|
111
91
|
function normalizePayloadParams(request) {
|
|
112
92
|
const defaultParams = {
|
|
113
93
|
chainId: request.chainId,
|