@relay-protocol/settlement-sdk 0.0.64

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.
@@ -0,0 +1,16 @@
1
+ import { ChainIdToVmType } from "../../utils";
2
+ export type DepositoryDepositMessage = {
3
+ data: {
4
+ chainId: string;
5
+ transactionId: string;
6
+ };
7
+ result: {
8
+ onchainId: string;
9
+ depository: string;
10
+ depositId: string;
11
+ depositor: string;
12
+ currency: string;
13
+ amount: string;
14
+ };
15
+ };
16
+ export declare const getDepositoryDepositMessageId: (message: DepositoryDepositMessage, chainsConfig: ChainIdToVmType) => `0x${string}`;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDepositoryDepositMessageId = void 0;
4
+ const viem_1 = require("viem");
5
+ const utils_1 = require("../../utils");
6
+ const getDepositoryDepositMessageId = (message, chainsConfig) => {
7
+ const vmType = (chainId) => (0, utils_1.getChainVmType)(chainId, chainsConfig);
8
+ return (0, viem_1.hashStruct)({
9
+ types: {
10
+ DepositoryDeposit: [
11
+ { name: "data", type: "Data" },
12
+ { name: "result", type: "Result" },
13
+ ],
14
+ Data: [
15
+ { name: "chainId", type: "string" },
16
+ { name: "transactionId", type: "bytes" },
17
+ ],
18
+ Result: [
19
+ { name: "onchainId", type: "bytes32" },
20
+ { name: "depository", type: "bytes" },
21
+ { name: "depositId", type: "bytes32" },
22
+ { name: "depositor", type: "bytes" },
23
+ { name: "currency", type: "bytes" },
24
+ { name: "amount", type: "uint256" },
25
+ ],
26
+ },
27
+ primaryType: "DepositoryDeposit",
28
+ data: {
29
+ data: {
30
+ chainId: message.data.chainId,
31
+ transactionId: (0, utils_1.encodeTransactionId)(message.data.transactionId, vmType(message.data.chainId)),
32
+ },
33
+ result: {
34
+ onchainId: (0, viem_1.bytesToHex)((0, utils_1.encodeBytes)(message.result.onchainId)),
35
+ depository: (0, utils_1.encodeAddress)(message.result.depository, vmType(message.data.chainId)),
36
+ depositId: (0, viem_1.bytesToHex)((0, utils_1.encodeBytes)(message.result.depositId)),
37
+ depositor: (0, utils_1.encodeAddress)(message.result.depositor, vmType(message.data.chainId)),
38
+ currency: (0, utils_1.encodeAddress)(message.result.currency, vmType(message.data.chainId)),
39
+ amount: message.result.amount,
40
+ },
41
+ },
42
+ });
43
+ };
44
+ exports.getDepositoryDepositMessageId = getDepositoryDepositMessageId;
@@ -0,0 +1,103 @@
1
+ import { ChainIdToVmType, VmType } from "../../utils";
2
+ export declare enum DepositoryWithdrawalStatus {
3
+ PENDING = 0,
4
+ EXECUTED = 1,
5
+ EXPIRED = 2
6
+ }
7
+ export type DepositoryWithdrawalMessage = {
8
+ data: {
9
+ chainId: string;
10
+ withdrawal: string;
11
+ };
12
+ result: {
13
+ withdrawalId: string;
14
+ depository: string;
15
+ status: DepositoryWithdrawalStatus;
16
+ };
17
+ };
18
+ export declare const getDepositoryWithdrawalMessageId: (message: DepositoryWithdrawalMessage, chainsConfig: ChainIdToVmType) => `0x${string}`;
19
+ export type DecodedEthereumVmWithdrawal = {
20
+ vmType: "ethereum-vm";
21
+ withdrawal: {
22
+ calls: {
23
+ to: string;
24
+ data: string;
25
+ value: string;
26
+ allowFailure: boolean;
27
+ }[];
28
+ nonce: string;
29
+ expiration: number;
30
+ };
31
+ };
32
+ export type DecodedTronVmWithdrawal = {
33
+ vmType: "tron-vm";
34
+ withdrawal: {
35
+ calls: {
36
+ to: string;
37
+ data: string;
38
+ value: string;
39
+ allowFailure: boolean;
40
+ }[];
41
+ nonce: string;
42
+ expiration: number;
43
+ };
44
+ };
45
+ export type DecodedSolanaVmWithdrawal = {
46
+ vmType: "solana-vm";
47
+ withdrawal: {
48
+ domain: string;
49
+ recipient: string;
50
+ token: string;
51
+ amount: string;
52
+ nonce: string;
53
+ expiration: number;
54
+ vaultAddress: string;
55
+ };
56
+ };
57
+ export type DecodedSuiVmWithdrawal = {
58
+ vmType: "sui-vm";
59
+ withdrawal: {
60
+ recipient: string;
61
+ coinType: string;
62
+ amount: string;
63
+ nonce: string;
64
+ expiration: number;
65
+ };
66
+ };
67
+ export type DecodedBitcoinVmWithdrawal = {
68
+ vmType: "bitcoin-vm";
69
+ withdrawal: {
70
+ psbt: string;
71
+ };
72
+ };
73
+ export type DecodedHyperliquidVmWithdrawal = {
74
+ vmType: "hyperliquid-vm";
75
+ withdrawal: {
76
+ txType: number;
77
+ parameters: {
78
+ type: "UsdSend";
79
+ hyperliquidChain: string;
80
+ destination: string;
81
+ amount: string;
82
+ time: string;
83
+ } | {
84
+ type: "SendAsset";
85
+ hyperliquidChain: string;
86
+ destination: string;
87
+ sourceDex: string;
88
+ destinationDex: string;
89
+ token: string;
90
+ amount: string;
91
+ fromSubAccount: string;
92
+ nonce: string;
93
+ };
94
+ };
95
+ };
96
+ type DecodedWithdrawal = DecodedEthereumVmWithdrawal | DecodedSolanaVmWithdrawal | DecodedSuiVmWithdrawal | DecodedBitcoinVmWithdrawal | DecodedTronVmWithdrawal | DecodedHyperliquidVmWithdrawal;
97
+ export declare const encodeWithdrawal: (decodedWithdrawal: DecodedWithdrawal) => string;
98
+ export declare const decodeWithdrawal: (encodedWithdrawal: string, vmType: VmType) => DecodedWithdrawal;
99
+ export declare const getDecodedWithdrawalId: (decodedWithdrawal: DecodedWithdrawal) => string;
100
+ export declare const getDecodedWithdrawalCurrency: (decodedWithdrawal: DecodedWithdrawal) => string;
101
+ export declare const getDecodedWithdrawalAmount: (decodedWithdrawal: DecodedWithdrawal) => string;
102
+ export declare const getDecodedWithdrawalRecipient: (decodedWithdrawal: DecodedWithdrawal) => string;
103
+ export {};