@relay-protocol/settlement-sdk 0.0.89 → 0.0.91
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 {
|
|
7
|
+
import { GenericMappingMessage, getGenericMappingMessageId, getNoFillOrRefundMessage, getNonceMappingMessage } from "./messages/v2.2/generic-mapping";
|
|
8
8
|
import { SubmitWithdrawRequest, DenormalizedSubmitWithdrawRequest, getSubmitWithdrawRequestHash, WithdrawalAddressParams, getWithdrawalAddress, OrderAddressParams, getOrderAddress, normalizePayloadParams } from "./messages/v2.2/withdrawal";
|
|
9
|
+
import { VmType, decodeAddress, decodeTransactionId, encodeAddress, encodeBytes, encodeTransactionId, getVmTypeNativeCurrency } from "./utils";
|
|
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, SubmitWithdrawRequest, DenormalizedSubmitWithdrawRequest, getSubmitWithdrawRequestHash, WithdrawalAddressParams, getWithdrawalAddress, OrderAddressParams, getOrderAddress, normalizePayloadParams, TokenIdComponents, VirtualAddressComponents, TokenId, VirtualAddress, generateAddress, generateTokenId, 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, getNoFillOrRefundMessage, getNonceMappingMessage, 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.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;
|
|
3
|
+
exports.generateTokenId = exports.generateAddress = exports.normalizePayloadParams = exports.getOrderAddress = exports.getWithdrawalAddress = exports.getSubmitWithdrawRequestHash = exports.getGenericMappingMessageId = exports.getNonceMappingMessage = exports.getNoFillOrRefundMessage = 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,15 @@ 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
|
+
Object.defineProperty(exports, "getNoFillOrRefundMessage", { enumerable: true, get: function () { return generic_mapping_1.getNoFillOrRefundMessage; } });
|
|
35
|
+
Object.defineProperty(exports, "getNonceMappingMessage", { enumerable: true, get: function () { return generic_mapping_1.getNonceMappingMessage; } });
|
|
36
|
+
const withdrawal_1 = require("./messages/v2.2/withdrawal");
|
|
37
|
+
Object.defineProperty(exports, "getSubmitWithdrawRequestHash", { enumerable: true, get: function () { return withdrawal_1.getSubmitWithdrawRequestHash; } });
|
|
38
|
+
Object.defineProperty(exports, "getWithdrawalAddress", { enumerable: true, get: function () { return withdrawal_1.getWithdrawalAddress; } });
|
|
39
|
+
Object.defineProperty(exports, "getOrderAddress", { enumerable: true, get: function () { return withdrawal_1.getOrderAddress; } });
|
|
40
|
+
Object.defineProperty(exports, "normalizePayloadParams", { enumerable: true, get: function () { return withdrawal_1.normalizePayloadParams; } });
|
|
32
41
|
const utils_1 = require("./utils");
|
|
33
42
|
Object.defineProperty(exports, "decodeAddress", { enumerable: true, get: function () { return utils_1.decodeAddress; } });
|
|
34
43
|
Object.defineProperty(exports, "decodeTransactionId", { enumerable: true, get: function () { return utils_1.decodeTransactionId; } });
|
|
@@ -36,11 +45,6 @@ Object.defineProperty(exports, "encodeAddress", { enumerable: true, get: functio
|
|
|
36
45
|
Object.defineProperty(exports, "encodeBytes", { enumerable: true, get: function () { return utils_1.encodeBytes; } });
|
|
37
46
|
Object.defineProperty(exports, "encodeTransactionId", { enumerable: true, get: function () { return utils_1.encodeTransactionId; } });
|
|
38
47
|
Object.defineProperty(exports, "getVmTypeNativeCurrency", { enumerable: true, get: function () { return utils_1.getVmTypeNativeCurrency; } });
|
|
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
48
|
const hub_utils_1 = require("./hub/hub-utils");
|
|
45
49
|
Object.defineProperty(exports, "generateAddress", { enumerable: true, get: function () { return hub_utils_1.generateAddress; } });
|
|
46
50
|
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:
|
|
16
|
+
oracleContract: Address;
|
|
16
17
|
};
|
|
17
18
|
export type ExecutionMessage = {
|
|
18
19
|
idempotencyKey: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type GenericMappingMessage = {
|
|
2
|
+
user: string;
|
|
3
|
+
id: string;
|
|
4
|
+
data: string;
|
|
5
|
+
nonce: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getNonceMappingMessage: (user: string, nonce: string, depositId: string) => GenericMappingMessage;
|
|
8
|
+
export declare const getNoFillOrRefundMessage: (solver: string, orderId: string) => GenericMappingMessage;
|
|
9
|
+
export declare const getGenericMappingMessageId: (message: GenericMappingMessage) => `0x${string}`;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getGenericMappingMessageId = exports.getNoFillOrRefundMessage = exports.getNonceMappingMessage = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const viem_1 = require("viem");
|
|
9
|
+
const getNonceMappingMessage = (user, nonce, depositId) => {
|
|
10
|
+
return {
|
|
11
|
+
user,
|
|
12
|
+
id: "0x" +
|
|
13
|
+
crypto_1.default
|
|
14
|
+
.createHash("sha256")
|
|
15
|
+
.update(`NONCE_MAPPING:${nonce}`)
|
|
16
|
+
.digest()
|
|
17
|
+
.toString("hex"),
|
|
18
|
+
data: depositId,
|
|
19
|
+
nonce: "0x" +
|
|
20
|
+
crypto_1.default
|
|
21
|
+
.createHash("sha256")
|
|
22
|
+
.update(`${user}:${nonce}`)
|
|
23
|
+
.digest()
|
|
24
|
+
.toString("hex"),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.getNonceMappingMessage = getNonceMappingMessage;
|
|
28
|
+
const getNoFillOrRefundMessage = (solver, orderId) => {
|
|
29
|
+
return {
|
|
30
|
+
user: solver,
|
|
31
|
+
id: "0x" +
|
|
32
|
+
crypto_1.default
|
|
33
|
+
.createHash("sha256")
|
|
34
|
+
.update(`NO_FILL_OR_REFUND:${orderId}`)
|
|
35
|
+
.digest()
|
|
36
|
+
.toString("hex"),
|
|
37
|
+
data: "0x01",
|
|
38
|
+
nonce: "0x" +
|
|
39
|
+
crypto_1.default
|
|
40
|
+
.createHash("sha256")
|
|
41
|
+
.update(`${solver}:${orderId}`)
|
|
42
|
+
.digest()
|
|
43
|
+
.toString("hex"),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.getNoFillOrRefundMessage = getNoFillOrRefundMessage;
|
|
47
|
+
const getGenericMappingMessageId = (message) => {
|
|
48
|
+
return (0, viem_1.hashStruct)({
|
|
49
|
+
types: {
|
|
50
|
+
SetEntry: [
|
|
51
|
+
{ name: "user", type: "address" },
|
|
52
|
+
{ name: "id", type: "bytes32" },
|
|
53
|
+
{ name: "data", type: "bytes" },
|
|
54
|
+
{ name: "nonce", type: "bytes32" },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
primaryType: "SetEntry",
|
|
58
|
+
data: {
|
|
59
|
+
user: message.user,
|
|
60
|
+
id: message.id,
|
|
61
|
+
data: message.data,
|
|
62
|
+
nonce: message.nonce,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
exports.getGenericMappingMessageId = getGenericMappingMessageId;
|